Cod sursa(job #1758401)
| Utilizator | Data | 17 septembrie 2016 10:37:46 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <fstream>
#include <string>
#include <vector>
using namespace std;
ifstream f("strmatch.in");
ofstream o("strmatch.out");
int main()
{
string p,s;
f >> p >> s;
vector <int> v;
int ans = 0;
for(int pos = s.find(p,0); pos != string::npos; pos = s.find(p,pos+1))
{
++ ans;
if(ans <= 1000)
v.push_back(pos);
}
o << ans << "\n";
for(auto i: v)
o << i << " ";
return 0;
}
