Cod sursa(job #1929180)

Utilizator abccnuCamelia Zalum abccnu Data 17 martie 2017 11:17:44
Problema Potrivirea sirurilor Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;

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

string str1, str2;
vector < int > sol;

int main()
{
    fin >> str1 >> str2;

    size_t p;
    p = str2.find(str1);

    while (p != string::npos)
    {

        sol .push_back(p);
        p = str2.find(str1, p+1);


    }
    fout << sol.size() << "\n";
    for (int i = 0; i < sol.size(); ++i)fout << sol[i] << " ";
     return 0;
}