Cod sursa(job #3306221)

Utilizator edw516Cernat Edward Florin edw516 Data 8 august 2025 16:49:54
Problema Potrivirea sirurilor Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.54 kb
#include <bits/stdc++.h>
using namespace std;

ifstream fin("strmatch.in");
ofstream fout("strmatch.out");


int main()
{
    string a;
    string b;

    fin >> a >> b;

    int ind = 0;
    int rez[2000001];
    for (int i = 0; i <= a.size() - b.size() + 1; i++)
    {
        int j = 0;

        while (j < b.size() && a[i + j] == b[j])
            j++;
        if (j == b.size())
        {
            rez[ind] = i + 1;
            ind++;
        }
    }

    for (int i = 0; i < ind; i++)
        fout << rez[i];
}