Cod sursa(job #3357765)
| Utilizator | Data | 13 iunie 2026 13:59:44 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
string A, B;
vector <int> V;
int main()
{
fin>>A>>B;
int poz=0;
while(B.find(A, poz) < B.size() && V.size - 1 < 1000)
{
//cout<<poz<<endl;
int poz_found = B.find(A, poz);
V.push_back(poz_found);
poz = poz_found + 1;
}
int lungV = V.size();
fout << min(1000, lungV) << endl;
for(int i = 0; i < min(1000, lungV); i++)
fout << V[i] << " ";
return 0;
}
