fork download
  1.  
  2. #include <algorithm>
  3. #include <string>
  4. #include <iostream>
  5.  
  6. int main()
  7. {
  8. std::string s = "This,,,,string,,contains a,,,,lot,of,,commas,,,";
  9. s.erase(std::remove(s.begin(), s.end(), ','), s.end());
  10. std::cout << s;
  11. }
  12.  
  13.  
Success #stdin #stdout 0s 4548KB
stdin
Standard input is empty
stdout
Thisstringcontains alotofcommas