Pagini recente » Cod sursa (job #1974132) | Cod sursa (job #2795622) | tema | Cod sursa (job #905794) | Cod sursa (job #2026905)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
const int nmax=(2<<21);
const int solmax=(2<<10);
char a[nmax],b[nmax],*p;
short sol[solmax];
int k;
int main()
{
fin>>a;
fin.get();
fin>>b;
p=strstr(b,a);
while(p)
{
sol[++k]=(p-b);
p++;
p=strstr(p,a);
}
k=min(k,1000);
fout<<k<<"\n";
for(int i=1;i<=k;i++)
fout<<sol[i]<<" ";
fout<<"\n";
fin.close();
fout.close();
return 0;
}