Pagini recente » Cod sursa (job #2723820) | Cod sursa (job #2728354) | Cod sursa (job #1988548) | Cod sursa (job #2419549) | Cod sursa (job #2214195)
#include <iostream>
#include <fstream>
#include <string.h>
#include <string>
#define dMAX 2000000
using namespace std;
int c;
string str1, str2;
size_t found;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
getline(fin, str1);
getline(fin, str2);
found = str2.find(str1);
while (found != string::npos) {
c++;
found = str2.find(str1, found + 1);
}
fout << c << '\n';
found = str2.find(str1);
while (found != string::npos) {
fout << found << ' ';
found = str2.find(str1, found + 1);
}
return 0;
}