Cod sursa(job #1595652)
| Utilizator | Data | 10 februarie 2016 14:17:06 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <string>
#include <vector>
#include <fstream>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
int N;
vector <int> poz;
string A,B;
size_t ff;
int main(){
ifstream f("strmatch.in");
ofstream g("strmatch.out");
for(f>>A>>B,ff = string::npos;;){
ff = B.find(A, ff+1);
if(ff == string::npos){
break;
}
N++;
if(N <= 1000){
poz.pb(ff);
}
}
g<<N<<'\n';
for(auto it : poz){
g<<it<<' ';
}
}
