#include <iostream>
using namespace std;
string str_replace(string orig, string rep, string str){
string tmp(str);
for (int pos = tmp.find(orig); pos != tmp.rfind(orig); pos = tmp.find(orig, pos)){
tmp = tmp.replace(pos, orig.length(), rep);
}
return tmp;
}
int main(int argc, char ** argv){
cout << str_replace(«lll», «ll», «Helllo, str_replace!») << endl;
return 0;
};