Cod sursa(job #3357769)

Utilizator rpetrachescuPetrachescu Rares Alexandru rpetrachescu Data 13 iunie 2026 14:05:17
Problema Potrivirea sirurilor Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <iostream>
#include <fstream>

using namespace std;

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

int main() {
    string a, b, r = "";
    int offset = 0, n = 0;
    fin >> a >> b;
    while (b.find(a, offset) <= b.size()) {
        int poz = b.find(a, offset);
        r += to_string(poz) + " ";
        offset = b.find(a, offset) + 1;
        n++;
    }
    cout << n << endl << r;
    return 0;
}