Cod sursa(job #1588052)
Utilizator | Data | 2 februarie 2016 19:15:35 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <fstream>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string A,B;
const size_t M=1000,oo=string::npos;
size_t n,k,sol[M+5];
int main()
{
for(f>>A>>B,n=oo;;){if((n=B.find(A,n+1))==oo)break;if(++k<=M)sol[k]=n;}
for(g<<k<<'\n',n=1;n<=k;n++)g<<sol[n]<<' ';
return 0;
}