Pagini recente » Istoria paginii utilizator/sethdarko | Cod sursa (job #1982621) | Monitorul de evaluare | Cod sursa (job #1988635) | Cod sursa (job #2214257)
#include <iostream>
#include <fstream>
#include <string.h>
#include <string>
#define dMAX 2000000
using namespace std;
int c;
string str1, str2;
int found;
int indexes[dMAX + 2];
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
int i;
fin >> str1 >> str2;
found = str2.find(str1);
while (found >= 0) {
indexes[++c] = found;
found = str2.find(str1, found + 1);
}
fout << c << '\n';
for (i = 1; i <= c; i++) fout << indexes[i] << ' ';
return 0;
}