Pagini recente » Cod sursa (job #60991) | Cod sursa (job #1722379) | Cod sursa (job #202639) | Cod sursa (job #3121179) | Cod sursa (job #301117)
Cod sursa(job #301117)
#include <fstream.h>
#include <iostream.h>
char a[2000000],b[2000000],*t;
int main()
{int k=0,i;
ifstream f("strmatch.in");
f.getline(a,2000000);
f.getline(b,2000000);
f.close();
t=b;
while (t=strstr(t,a))
{++k;
++t;}
t=b;
ofstream fout("strmatch.out");
fout<<k<<endl;
if (k>1000) k=1000;
for(i=1;i<=k;i++)
{t=strstr(t,a);
t++;
fout<<t-b<<" ";
}
fout.close();
//system("pause");
return 0;
}