Pagini recente » Cod sursa (job #1232442) | Cod sursa (job #1512220) | Cod sursa (job #1603542) | Cod sursa (job #350588) | Cod sursa (job #1757464)
#include <fstream>
#include <vector>
#include <string>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main() {
string a, b;
fin >> a >> b;
int ans = 0;
vector<size_t> positions;
for (size_t pos = b.find(a, 0); pos != string::npos; pos = b.find(a, pos + 1)) {
ans++;
if (ans <= 1000)
positions.push_back(pos);
}
fout << ans << '\n';
for (auto pos : positions)
fout << pos << ' ';
fout << '\n';
return 0;
}
//Trust me, I'm the Doctor!