Cod sursa(job #3357753)
| Utilizator | Data | 13 iunie 2026 13:50:32 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main() {
string a, b;
bool run = true;
int offset = 0;
fin >> a >> b;
while (true) {
//cout << b.find(a) << " --- \n";
if (b.find(a) > b.length()) {
break;
}
fout << offset + b.find(a) << ' ';
//cout << b << endl;
offset += b.find(a)+1;
b.erase(0, b.find(a)+1);
}
return 0;
}
/*
ABA
CABBCABABAB
ABA
*/
