Cod sursa(job #1418566)
| Utilizator | Data | 13 aprilie 2015 14:37:31 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 38 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <fstream>
#include <string>
#include <queue>
std::ifstream fin("strmatch.in");
std::ofstream fout("strmatch.out");
std::string ac, hatch;
std::queue<std::size_t> rs;
int main() {
fin >> ac >> hatch;
std::size_t pos = 0;
while (1) {
pos = hatch.find(ac, pos + 1);
if (pos == std::string::npos) break;
else rs.push(pos);
}
fout << rs.size() << "\n";
while (!rs.empty()) {
fout << rs.front() << " ";
rs.pop();
}
fout << "\n";
return 0;
}
