Pagini recente » Cod sursa (job #1889200) | Cod sursa (job #343832) | Cod sursa (job #2950737) | Cod sursa (job #2281004) | Cod sursa (job #2331001)
#include <bits/stdc++.h>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
char a[2000001],b[2000001],*p;
int i,nr,poz,sters;
int main()
{
int potrivire[1001];
f>>a>>b;int la=strlen(a);
while(strstr(b,a))
{
p=strstr(b,a);
poz=p-b;
potrivire[++nr]=poz+sters;
strcpy(b,b+poz+la);
sters+=poz+la;
}
g<<nr<<'\n';
for(i=1;i<=nr;i++)
g<<potrivire[i]<<' ';
return 0;
}