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