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