Pagini recente » Cod sursa (job #1592509) | Cod sursa (job #2896383) | Cod sursa (job #996343) | Cod sursa (job #362762) | Cod sursa (job #2905652)
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
char A[2000001], B[2000001];
int v[1000], pos = 0, times = 0;
int main() {
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
fin >> A;
fin >> B;
char *p = strstr(B, A);
if (p != 0) {
++times;
}
while (p != 0) {
++pos;
v[pos] = p - B;
p = strstr(p + 1, A);
if (p != 0) {
++times;
}
}
fout << times << '\n';
for (int i = 1; i <= pos; ++i) {
fout << v[i] << ' ';
}
return 0;
}