Pagini recente » Cod sursa (job #629942) | Cod sursa (job #2634751) | Cod sursa (job #455869) | Cod sursa (job #2414239) | Cod sursa (job #1281253)
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
char v[2000001],w[2000001];
int main()
{
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
fin>>v;
fin>>w;
char *p;
p=strstr(w,v);
int nr=0,q[1002];
while(p)
{
q[++nr]=p-w;
p=strstr(p+1,v);
if(nr==1000)
p=0;
}
fout<<nr<<endl;
for(int a=1;a<=nr;a++)
fout<<q[a]<<" ";
}