Cod sursa(job #1595645)
| Utilizator | Data | 10 februarie 2016 14:12:12 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 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;
int main(){
ifstream f("strmatch.in");
ofstream g("strmatch.out");
f>>A;
f>>B;
size_t ff = B.find(A);
while(ff != string::npos){
poz.pb(ff);
if(N <= 1000){
ff = B.find(A, ff+1);
}
N++;
}
g<<(N < 1000 ? N : 1000)<<'\n';
for(auto it : poz){
g<<it<<' ';
}
}
