fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main(int argc, char const *argv[])
  8. {
  9.  
  10. std::string s("a,b,c,d,e,f,");
  11.  
  12. std::replace_if(s.begin(), s.end(), [](char c){return c == ','; }, ' ');
  13. cout << s << endl;
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
a b c d e f