Viem, ze by sa to nemalo, ale dam aj kod. Staci ist postupne a pouzit este jeden string ako to mam ja alebo cez delete a insert.
Kód:
#include <bits/stdc++.h>
using namespace std;
string f(string a, char b, string c)
{
string r;
for(int i = 0; i < a.size(); i++)
if(a[i] == b)
r += c;
else
r += a[i];
return r;
}
int main()
{
string a = "toto je retazec ooo";
char b = 'o';
string c = "_ha_";
cout << f(a, b, c) << endl;
return 0;
}