Cod sursa(job #2880372)

Utilizator T1raduTaerel Radu Nicolae T1radu Data 29 martie 2022 17:36:11
Problema Potrivirea sirurilor Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.4 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
char a[2000001],b[2000001];
int poz[2000001],t;
int main()
{
    fin >> a >> b;
    char *p=strstr(b,a);
    while(p)
    {
        poz[++t]=p-b;
        p=strstr(p+1,a);
    }
    fout << t << "\n";
    for(int i=1;i<=t;i++)
        fout << poz[i] << " ";
    return 0;
}