Cod sursa(job #1984680)

Utilizator ArctopusKacso Peter-Gabor Arctopus Data 25 mai 2017 17:46:15
Problema Potrivirea sirurilor Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <iostream>
#include <fstream>
#include <list>
#include <vector>

using namespace std;

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

string A;
string B;

vector< int > res;

int main()
{
    fin >> A;
    fin >> B;

    int loc = B.find(A);
    while( loc != -1 )
    {
        res.push_back( loc );
        loc = B.find( A, loc + 1 );
    }

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

    return 0;
}