Cod sursa(job #1911951)

Utilizator RaZxKiDDavid Razvan RaZxKiD Data 7 martie 2017 22:22:57
Problema Potrivirea sirurilor Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;

ifstream in("strmatch.in");
ofstream out("strmatch.out");

string A,B;
vector<int> SOL;

void read(){
    in>>A>>B;
}
void solve(){
    int sol=0;
    int poz=B.find(A,0);
    while(poz!=-1){
        sol++;
        if(sol<=1000)SOL.push_back(poz);
        poz=B.find(A,poz+1);
    }
    out<<sol<<"\n";
    for(auto x : SOL)
        out<<x<<" ";
}
int main(){
    read();
    solve();
    return 0;
}