Cod sursa(job #2604778)
| Utilizator | Data | 23 aprilie 2020 15:09:41 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 80 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include <bits/stdc++.h>
using namespace std;
using Vector = vector<int>;
const string task("strmatch");
ifstream fin(task + ".in");
ofstream fout(task + ".out");
int main() {
ios_base::sync_with_stdio(false);
fin.tie(0);
fout.tie(0);
string a, b;
fin >> a >> b;
size_t p = b.find(a);
vector<size_t> v;
int cnt(0);
while (p != string::npos) {
if (v.size() < 1000)
v.push_back(p);
++cnt;
p = b.find(a, p+1);
}
fout << cnt << '\n';
for (const auto& it : v)
fout << it << ' ';
}
