Cod sursa(job #1595648)

Utilizator alittlezzCazaciuc Valentin alittlezz Data 10 februarie 2016 14:14:39
Problema Potrivirea sirurilor Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include <string>
#include <vector>
#include <fstream>

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair

int N;
vector <int> poz;
string A,B;

int main(){
    ifstream f("strmatch.in");
    ofstream g("strmatch.out");
    f>>A;
    f>>B;
    size_t ff = B.find(A);
    while(ff != string::npos){
        if(N <= 1000){
            poz.pb(ff);
        }
        ff = B.find(A, ff+1);
        N++;
    }
    g<<N<<'\n';
    for(auto it : poz){
        g<<it<<' ';
    }
}