Cod sursa(job #301117)
| Utilizator | Data | 7 aprilie 2009 22:30:18 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 14 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <fstream.h>
#include <iostream.h>
char a[2000000],b[2000000],*t;
int main()
{int k=0,i;
ifstream f("strmatch.in");
f.getline(a,2000000);
f.getline(b,2000000);
f.close();
t=b;
while (t=strstr(t,a))
{++k;
++t;}
t=b;
ofstream fout("strmatch.out");
fout<<k<<endl;
if (k>1000) k=1000;
for(i=1;i<=k;i++)
{t=strstr(t,a);
t++;
fout<<t-b<<" ";
}
fout.close();
//system("pause");
return 0;
}
