Cod sursa(job #3357751)

Utilizator nopreanOprean Natasha noprean Data 13 iunie 2026 13:47:37
Problema Potrivirea sirurilor Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 kb
#include <bits/stdc++.h>

using namespace std;
string A, B;
vector <int> V;
int main()
{
    cin>>A>>B;
    int poz=0;
    while(B.find(A, poz) < B.size())
    {
        int poz_found = B.find(A, poz);
        V.push_back(poz_found);
        poz = poz_found + A.size() - 1;
    }
    int lungV = V.size();
    cout << min(1000, lungV) << endl;
    for(int i = 0; i < min(1000, lungV); i++)
        cout << V[i] << " ";
    return 0;
}