Pagini recente » Cod sursa (job #2770421) | Cod sursa (job #2153799) | Cod sursa (job #2489193) | Cod sursa (job #1389767) | 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]<< " ";
}