Cod sursa(job #2214251)
| Utilizator | Data | 18 iunie 2018 17:02:25 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <iostream>
#include <fstream>
#include <string.h>
#include <string>
#define dMAX 2000000
using namespace std;
int c;
string str1, str2;
int found;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
getline(fin, str1);
getline(fin, str2);
found = str2.find(str1);
while (found >= 0) {
c++;
found = str2.find(str1, found + 1);
}
fout << c << '\n';
found = str2.find(str1);
while (found >= 0) {
fout << found << ' ';
found = str2.find(str1, found + 1);
}
return 0;
}
