Cod sursa(job #1154282)
| Utilizator | Data | 26 martie 2014 08:36:31 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <fstream>
#include <string>
#include <vector>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string a, b;
int pos, n;
vector<int> x;
int main()
{
f >> a >> b;
pos = 0;
pos = b.find(a, pos);
while (pos != -1)
{
x.push_back(pos);
pos = b.find(a, pos+1);
}
g << x.size() << "\n";
for (vector<int>::iterator i=x.begin(); i<x.end(); i++)
g << *i << " ";
}
