Cod sursa(job #2485590)
| Utilizator | Data | 1 noiembrie 2019 19:45:12 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
ifstream fin("strmatch.in"); ofstream fout("strmatch.out");
string a, b;
int n; vector<int> c;
int main(){
fin>>a>>b;
for(int i=0; i<b.length(); i++){
if(b[i]==a[0]){
for(int j=1; j<a.length() && i+j<b.length(); j++){
if(a[j]!=b[i+j]){break;}
else{
if(j==a.length()-1){n++; if(n<=1000){c.pb(i);}}}
}
}
}
fout<<n<<endl;
for(int i=0; i<c.size(); i++){
fout<<c[i]<<' ';
}
return 0;
}
