Cod sursa(job #2322757)

Utilizator bogdan2604Bogdan Dumitrescu bogdan2604 Data 18 ianuarie 2019 11:57:34
Problema Potrivirea sirurilor Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include <fstream>
#include <cstring>
#include <queue>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string a,b;
queue <int> q;
int t,x;
int main()
{
    f>>b>>a;
    while(t<1000 && a.find(b)!=string::npos)
    {
        q.push(a.find(b)+x+t);
        x+=a.find(b);
        a.erase(0,a.find(b)+1);
        t++;
    }
    g<<t<<'\n';
    while(!q.empty())
    {
        g<<q.front()<<' ';
        q.pop();
    }
}