Cod sursa(job #3357768)

Utilizator nopreanOprean Natasha noprean Data 13 iunie 2026 14:01:31
Problema Potrivirea sirurilor Scor 40
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() < 999)
    {
        //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;
}