Cod sursa(job #3357760)
| Utilizator | Data | 13 iunie 2026 13:54:28 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 80 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <bits/stdc++.h>
using namespace std;
#define int long long
ifstream f("strmatch.in");
ofstream g("strmatch.out");
vector<int> pozit;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string A,B;
int off=0,poz,N=0,i;
f>>A>>B;
while(B.find(A,off)!=string::npos){
poz=B.find(A,off);
if(pozit.size()<1000){
pozit.push_back(poz);
}
off=poz+1;
N++;
}
g<<N<<"\n";
for(auto i:pozit){
g<<i<<" ";
}
return 0;
}