Cod sursa(job #166831)
| Utilizator | Data | 28 martie 2008 15:47:03 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 18 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <stdio.h>
#include <string.h>
long num, i, n, poz[200], npoz;
char x[200], y[200];
int main()
{
freopen ("strmatch.in", "rt", stdin);
freopen ("strmatch.out", "wt", stdout);
scanf("%s\n%s", x, y);
n = strlen(y) - 1;
char *p = strstr(y, x);
while (p)
{
num ++;
poz[++npoz] = p - y;
p = strstr(p + 1, x);
}
printf("%ld\n", num);
for (i = 1; i <= npoz; ++i)
printf("%ld ", poz[i]);
printf("\n");
return 0;
}