Cod sursa(job #2229858)

Utilizator cezarzbughinCezar Zbughin cezarzbughin Data 8 august 2018 11:49:12
Problema Potrivirea sirurilor Scor 80
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include <bits/stdc++.h>

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

}