Cod sursa(job #716671)
| Utilizator | Data | 19 martie 2012 09:16:12 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.4 kb |
#include <string>
#include <fstream>
#include <vector>
using namespace std;
ifstream in("strmatch.in");
ofstream out("strmatch.out");
string a, b;
int main()
{
in >> a >> b;
int p = 0;
vector<int> pos;
while( (p = b.find(a, p)) != string::npos )
{
pos.push_back(p);
p++;
}
out << pos.size() << '\n';
for(p = 0; p < (signed)pos.size(); p++)
out << pos[p] <<' ';
}
