Pagini recente » Cod sursa (job #2849646) | Cod sursa (job #3270216) | Cod sursa (job #3125597) | Cod sursa (job #1857517) | Cod sursa (job #1154282)
#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 << " ";
}