Pagini recente » Cod sursa (job #2791101) | Cod sursa (job #495408) | Cod sursa (job #414286) | Cod sursa (job #2320750) | Cod sursa (job #998245)
Cod sursa(job #998245)
#include <cstdio>
#include <cstring>
char a[2000001];
char b[2000001];
int ind[1001];
char s[2000001];
int main()
{
freopen("strmatch.in","r",stdin);
freopen("strmatch.out","w",stdout);
scanf("%s%s",a,b);
int n = strlen(b);
int m = strlen(a);
int aparitii = 0;
for(int i = 0; i<n; i++)
{
strcpy(s,b+i);
s[m] = '\0';
if(!strcmp(s,a))
{
ind[aparitii++] = i;
if(aparitii>=1000)
break;
}
}
printf("%d\n",aparitii);
for(int i =0; i<aparitii; i++)
printf("%d ",ind[i]);
}