fork(3) download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. int main(){
  6. std::string s1 = " Hello World 1 ";
  7. std::string s2 = " Hello World 2 ";
  8. while(s1.find(' ') != std::string::npos){
  9. s1.erase(s1.find(' '));
  10. }
  11. while(s2.find(' ') != std::string::npos){
  12. s2.erase(std::find(s2.begin() , s2.end() ,' '));
  13. }
  14. std::cout<<s1<<"\n";
  15. std::cout<<s2;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
HelloWorld2