Pagini recente » Cod sursa (job #2168927) | Cod sursa (job #1966920) | Cod sursa (job #402282) | Cod sursa (job #107971) | Cod sursa (job #1923432)
#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstring>
using namespace std;
ifstream f ("strmatch.in");
ofstream g ("strmatch.out");
char v[2000000],*p,x[2000000];
bool ap[1001];
int main()
{
int nr=0,i;
f.get(x,2000000);
f.get();
f.get(v,2000000);
f.get();
p=strstr(v,x);
while(p!=NULL)
{
nr++;
ap[p-v]=1;
p++;
p=strstr(p,x);
}
g<<nr<<endl;
g.flush();
for(i=0;i<=1001;i++)
if(ap[i]!=0)
g<<i<<' ';
g.flush();
return 0;
}