Pagini recente » emag_2016-incepatori-4 | Cod sursa (job #2851651) | Cod sursa (job #3164660) | Cod sursa (job #374826) | Cod sursa (job #254091)
Cod sursa(job #254091)
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define InFile "strmatch.in"
#define OutFile "strmatch.out"
#define MAX 2000001
char A[MAX],B[MAX];
long v[MAX],lg=0;
int main()
{FILE *f=freopen(InFile,"rt",stdin),*g=freopen(OutFile,"wt",stdout);
scanf("%s %s",&A,&B);
char *p=strstr(B,A);
while(p)
{v[++lg]=p-B;
p=strstr(p+1,A);
}
printf("%ld\n",lg);
for(long i=1;i<=lg;i++) printf("%ld ",v[i]);
fclose(f); fclose(g);
return 0;
}