Pagini recente » Cod sursa (job #2260388) | Cod sursa (job #2891301) | Cod sursa (job #2805188) | Cod sursa (job #1267951) | Cod sursa (job #2595409)
#include <stdio.h>
#include <string.h>
char s[2000001], t[2000001], *pch;
int main () {
freopen ("strmatch.in", "r", stdin);
FILE *fout=fopen ("strmatch.out", "w");
gets(t);
gets(s);
pch=strstr(s, t);
fprintf (fout, " \n");
long long ct=0;
while (pch && ct<1000) {
++ct;
fprintf (fout, "%lld ", pch-s);
pch=strstr(pch+1, t);
}
fseek(fout, 0, SEEK_SET);
fprintf (fout, "%lld", ct);
return 0;
}