Cod sursa(job #3212205)

Utilizator AlexMoto2006Motoasca Alexandru-Lucian AlexMoto2006 Data 11 martie 2024 12:29:04
Problema Potrivirea sirurilor Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
// ConsoleApplication2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <fstream>
#include <vector>
#include <string>

using namespace std;

ifstream cin("strmatch.in");
ofstream cout("strmatch.out");

string A, B;
int pos;
vector <int> app;

int main() {
    cin >> A >> B;
    pos = B.find(A);
    while (pos != string::npos)
    {
		app.push_back(pos);
		pos = B.find(A, pos + 1);
	}
    cout << app.size() << "\n";
    for(int i=0;i<app.size();i++)
		cout << app[i] << " ";
    return 0;
}