Cod sursa(job #3326558)
| Utilizator | Data | 29 noiembrie 2025 14:05:41 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
int main() {
string s1, s2;
int pos = 0, cont = 0;
vector<int> ans;
f >> s1 >> s2;
while (s2.find(s1, pos) != string::npos) {
pos = s2.find(s1, pos) + 1;
cont++;
ans.push_back(pos - 1);
}
g << cont << "\n";
for (auto it : ans)
g << it << " ";
}
