fork(4) download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. string str = " texto com espaços em branco ";
  9. str.erase(remove(str.begin(), str.end(), ' '), str.end());
  10. cout << str;
  11. return 0;
  12. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
textocomespaçosembranco