Pagini recente » Cod sursa (job #1842532) | Cod sursa (job #2352522) | Cod sursa (job #2195523) | Cod sursa (job #2909350) | Cod sursa (job #1418587)
#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 = -1;
int p = 0;
while (1) {
pos = hatch.find(ac, pos + 1);
if (pos == std::string::npos) break;
else {
p++;
if (p <= 1000)
// fout<<p<<"s\n";
rs.push(pos);
}
}
fout << p << "\n";
while (!rs.empty()) {
fout << rs.front() << " ";
rs.pop();
}
fout << "\n";
return 0;
}