Cod sursa(job #1913024)

Utilizator VladTiberiuMihailescu Vlad Tiberiu VladTiberiu Data 8 martie 2017 11:33:43
Problema Potrivirea sirurilor Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <bits/stdc++.h>

using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");

string x,y;
vector<int> ans;
int T,p;

int main()
{
    f >> x >> y;
    p = -1;
    while(true){
        p = y.find(x,p + 1);
        if(p < y.size()){
            if(ans.size() < 1000)
                ans.push_back(p);
            T++;
        }else
            break;
    }
    g << T << '\n';
    for(int i = 0; i < ans.size(); ++i){
        g << ans[i] << ' ';
    }
    return 0;
}