Cod sursa(job #2372875)
| Utilizator | Data | 7 martie 2019 11:25:15 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#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();
}
}
