Cod sursa(job #879202)

Utilizator Edward2012Eduard Ursinschi Edward2012 Data 15 februarie 2013 08:27:44
Problema Potrivirea sirurilor Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.4 kb
#include <fstream>
#include <string.h>

using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
char A[2000000],B[2000000],*p;
int v[2000000],k,ok,i;
int main()
{f.getline(A,2000000);
 f.getline(B,2000000);
 ok=strlen(B);
while(strstr(B,A))
{p=strstr(B,A);
v[++k]=ok-strlen(p);
p[0]='-';
}
 g<<k<<'\n';
 for(i=1;i<=k;i++) g<<v[i]<<' ';
 g<<'\n';


    return 0;
}