Pagini recente » Atasamentele paginii Profil Teo | Cod sursa (job #2508610) | Monitorul de evaluare | Cod sursa (job #2036354) | Cod sursa (job #2487087)
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int ap[1000], n;
int main() {
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
char a[2000001], b[2000001];
fin >> a >> b;
char *s = strstr(b, a);
while(s != NULL) {
ap[n++] = s-b;
s = strstr(s+1, a);
}
fout << n << endl;
for(int i = 0; i < n && i<1000; i++)
fout << ap[i] << " ";
return 0;
}