Cod sursa(job #3137376)

Utilizator proflaurianPanaete Adrian proflaurian Data 12 iunie 2023 18:27:43
Problema Potrivirea sirurilor Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.49 kb
#include <bits/stdc++.h>

using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string a,b;
size_t poz,Max;
int cnt;
vector<size_t> sol;
int main()
{
    f>>a>>b;
    poz=b.find(a);
    while(poz!=string::npos)
    {
        cnt++;
        if(cnt<1000)
            sol.push_back(poz);
        poz=b.find(a,poz+1);
    }
    g<<cnt<<'\n';
    for(auto it:sol)
        g<<it<<' ';
    return 0;
}


//a=ABA
//b=CABBCABABAB
//         ABA
//       5 7