Cod sursa(job #3233819)
Utilizator | Data | 5 iunie 2024 00:48:33 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include<bits/stdc++.h>
std::ifstream fin("strmatch.in");
std::ofstream fout("strmatch.out");
char A[2000001], B[2000001];
std::vector<int> ap;
int main(){
fin >> A >> B;
char* p = strstr(B, A);
while(p){
ap.push_back(p - B);
p = strstr(p + 1, A);
}
fout << ap.size() << '\n';
for(const int& x : ap)
fout << x << ' ';
}