Cod sursa(job #1587904)
| Utilizator | Data | 2 februarie 2016 17:36:45 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include <fstream>
#include <string>
#include <vector>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string A,B;
size_t n,k;
vector<size_t>sol;
int main()
{
f>>A>>B;
n=string::npos;
for(;;)
{
n=B.find(A,n+1);
if(n==string::npos)break;
k++;
if(sol.size()<1000)sol.push_back(n);
}
g<<k<<'\n';
for(auto it:sol)
g<<it<<' ';
return 0;
}
