Cod sursa(job #2229851)

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

using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string a,b;
size_t 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;

}