Pagini recente » Cod sursa (job #3218811) | Cod sursa (job #1943975) | Cod sursa (job #2520335) | Cod sursa (job #1348160) | Cod sursa (job #1418575)
#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";
int p = 0;
while (!rs.empty()) {
fout << rs.front() << " ";
rs.pop();
p++;
if (p == 1000) break;
}
fout << "\n";
return 0;
}