Cod sursa(job #879319)

Utilizator Edward2012Eduard Ursinschi Edward2012 Data 15 februarie 2013 11:23:46
Problema Potrivirea sirurilor Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.41 kb
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
char A[2000001],B[2000001],*p;
int v[2000001],k,ok,i;
int main()
{f.getline(A,2000001);
 f.getline(B,2000001);
 ok=strlen(B);
while(strstr(B,A) && k<1000)
{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;
}