Cod sursa(job #1734778)

Utilizator triscacezarTrisca Vicol Cezar triscacezar Data 28 iulie 2016 11:23:18
Problema Potrivirea sirurilor Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.47 kb
#include <fstream>
#include <vector>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string A,B;
size_t poz=string::npos;
int sol;
vector<size_t> x;
int main()
{
    f>>A>>B;
    for(;;)
    {
        poz++;
        poz=B.find(A,poz);
        if(poz==string::npos)
            break;
        sol++;
        if(sol<=1000)
            x.push_back(poz);
    }
    g<<sol<<'\n';
    for(auto it:x)
        g<<it<<' ';
    return 0;
}