Pagini recente » Cod sursa (job #665967) | igorj_mentorat1 | 2233 | Rating Andrei (gigamhz) | Cod sursa (job #1776785)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream in("strmatch.in");
ofstream out("strmatch.out");
vector <int> sol;
int main()
{
string a, b;
in >> a >> b;
b = "#" + b;
int poz = 0;
poz = b.find(a, 1);
while(poz != -1&& poz < (int)b.size())
{
sol.push_back(poz);
poz = b.find(a, poz + 1);
}
out << sol.size() << "\n";
for(unsigned int i = 0; i <= min((unsigned int)999, sol.size() - 1); i++)
out << sol[i] - 1 << " ";
out << "\n";
return 0;
}