Cod sursa(job #2331007)

Utilizator maria.tantosMaria Iuliana Tantos maria.tantos Data 29 ianuarie 2019 08:44:26
Problema Potrivirea sirurilor Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <bits/stdc++.h>
using namespace std;

ifstream f("strmatch.in");
ofstream g("strmatch.out");

///memoria de date
char a[2000001],*p;
int i,nr,poz,sters;

int main()
{
    ///memoria stiva
    int potrivire[1001];
    char b[2000001];
    f>>a>>b;int la=strlen(a);
    while(strstr(b+i,a))
    {
        p=strstr(b+i,a);
        poz=p-b;
        potrivire[++nr]=poz;
        i=poz+1;
        if(nr==1000) break;
    }
    g<<nr<<'\n';
    for(i=1;i<=nr;i++)
        g<<potrivire[i]<<' ';
    return 0;
}