Cod sursa(job #1429065)

Utilizator teoceltareconstantin teodor teoceltare Data 5 mai 2015 16:52:58
Problema Potrivirea sirurilor Scor 24
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
std::ifstream fin("strmatch.in");
std::ofstream fout("strmatch.out");
int v[1010];
long long n=0;
std::string a,b;
int main()
{
    fin>>a>>b;
    int x;
    x=b.find(a);
        while(x)
        {
            n++;
            if(n<=1000)
            {
                v[n]=x;
            }
            x=b.find(a,x+1);
            if (x == std::string::npos) break;
        }
    fout<<n<<endl;
    for(int a=1;a<=n;a++)
    {
        fout<<v[a]<<" ";
    }
}