fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string s = "fhigkaigibjhmhlskmg";
  8. char f = 'g';
  9. char rep = '@';
  10. int pos = string::npos;
  11. while((pos = s.find(f)) != string::npos)
  12. {
  13. s[pos] = rep;
  14. }
  15. cout<<s<<endl;
  16. }
Success #stdin #stdout 0.02s 2856KB
stdin
Standard input is empty
stdout
fhi@kai@ibjhmhlskm@