fork(26) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. string s = "quick:brown:fox:jumps:over:the:lazy:dog";
  8. int i = 0;
  9. for (;;) {
  10. i = s.find(":", i);
  11. if (i == string::npos) {
  12. break;
  13. }
  14. s.replace(i, 1, "%%");
  15. }
  16. cout << s << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.02s 2856KB
stdin
Standard input is empty
stdout
quick%%brown%%fox%%jumps%%over%%the%%lazy%%dog