Pagini recente » Cod sursa (job #2566985) | Cod sursa (job #1976732) | Cod sursa (job #2688067) | Cod sursa (job #2613486) | Cod sursa (job #2372875)
#include <iostream>
#include <string>
#include <fstream>
#include <deque>
std::ifstream in("strmatch.in");
std::ofstream out("strmatch.out");
int main()
{
std::string what;
std::string where;
std::deque<int> X;
in >> what;
in >> where;
int howMany = 0;
std::size_t found = where.find(what);
while(found != std::string::npos)
{
howMany++;
X.push_back(found);
found = where.find(what, found+1);
}
out<<howMany<<'\n';
while(!X.empty())
{
out<<X.front()<<" ";
X.pop_front();
}
}