Pagini recente » Cod sursa (job #2105541) | Cod sursa (job #499531) | Cod sursa (job #367917) | Cod sursa (job #2110544) | Cod sursa (job #879536)
Cod sursa(job #879536)
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
int main() {
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
char a[2000000], s[2000000];
fin >> a >> s;
//cout << a << ' ' << s;
char * match[10001];
int i=0;
match[0]=s;
//cout << (match[1]=strstr(match[0],a));
while (true) {
match[i+1]=strstr(match[i]+1,a);
if (match[++i]==NULL) break;
}
fout << i-1 << '\n';
i=min(i,1001);
for (int j=1; j<i; ++j) {
fout << match[j]-s << ' ';
}
return 0;
}