Cod sursa(job #538993)
| Utilizator | Data | 22 februarie 2011 10:26:41 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.38 kb |
#include <cstdio>
#include <string>
using namespace std;
char s[2000001],c[2000001],*p;
int a[1001],n;
int main(){
freopen("strmatch.in","r",stdin);
freopen("strmatch.out","w",stdout);
scanf("%s%s",&s,&c);
p=strstr(c,s);
while (p&&n<1000){
a[++n]=p-c;
p=strstr(p+1,s);
}
printf("%d\n",n);
for(int i=1;i<=n;++i)
printf("%d ",a[i]);
return 0;
}
