Pagini recente » Cod sursa (job #2794800) | Cod sursa (job #1115886) | Cod sursa (job #2307525) | Cod sursa (job #182626) | Cod sursa (job #1418566)
#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;
}