Pagini recente » Cod sursa (job #365426) | Cod sursa (job #3213105) | Cod sursa (job #2637120) | Cod sursa (job #446240) | Cod sursa (job #2675018)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f ("strmatch.in");
ofstream g ("strmatch.out");
char A[2000001],B[2000001];
int poz[2000001];
int main()
{
f >> A >> B;
int cnt = 1;
char *p = strstr(B,A);
while(p)
{
poz[cnt++] = p-B;
p = strstr(p+1,A);
}
g << cnt-1<< '\n';
for(int i = 1;i<cnt;i++)
g << poz[i]<< " ";
}