Cod sursa(job #1912189)
Utilizator | Data | 7 martie 2017 23:53:16 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include <bits/stdc++.h>
using namespace std;int nr=0;vector<int> sol;string a,b;int main(){ifstream f("strmatch.in");f>>a>>b;int pos=-1;while(1){pos=b.find(a,pos+1);if(pos==-1) break;nr++;if(nr<=1000) sol.push_back(pos);}ofstream g("strmatch.out");g<<nr<<"\n";for(int i=0;i<min(nr,1000);i++) g<<sol[i]<<" ";}