Cod sursa(job #2045788)

Utilizator enedumitruene dumitru enedumitru Data 22 octombrie 2017 20:57:08
Problema Potrivirea sirurilor Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.35 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("strmatch.in"); ofstream g("strmatch.out");
char a[2000005],b[2000005];
int main()
{   f>>a>>b;
    int lgb=strlen(b),n=0,v[1005];
    char *c=strstr(b,a);
    while(c && n<1000) {v[++n]=lgb-strlen(c); c=strstr(c+1,a);}
    g<<n<<'\n';
    for(int i=1;i<=n;i++) g<<v[i]<<" ";
}