Cod sursa(job #2595409)
| Utilizator | Data | 7 aprilie 2020 17:54:03 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | c-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#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;
}
