Cod sursa(job #879318)
| Utilizator | Data | 15 februarie 2013 11:22:08 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.37 kb |
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
char A[2000001],B[2000001],*p;
int v[2000001],k,ok,i;
int main()
{f.getline(A,2000000);
f.getline(B,2000000);
ok=strlen(B);
while(strstr(B,A) && k<1000)
{p=strstr(B,A);
v[++k]=ok-strlen(p);
p[0]='-';
}
g<<k<<'\n';
for(i=1;i<=k;i++) g<<v[i]<<' ';
g<<'\n';
return 0;
}
