Cod sursa(job #180638)
Utilizator | Data | 17 aprilie 2008 12:22:24 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 18 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include<fstream.h>
#include<string.h>
ifstream f("strmatch.in");
ofstream g("strmatch.out");
char a[2000000],b[2000000];
long int c[20000],p,d;
int main()
{ f>>a;
f>>b;
while(strstr(b,a))
{ p++;
c[p]=strlen(b)-strlen(strstr(b,a))+d;
strcpy(strstr(b,a),strstr(b,a)+1);
d++;
}
g<<p<<"\n";
for(int i=1;i<=p;i++)
g<<c[i]<<"\n";
f.close();
g.close();
return 0;
}