fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4.  
  5. int main() {
  6. std::string line;
  7. while (std::getline(std::cin, line)) // reads in a line
  8. {
  9. std::istringstream stream(line);
  10. std::string spaceless;
  11. std::string word;
  12. while (stream >> word) // get words on the line without any whitespace
  13. {
  14. spaceless += word; // assemble without spaces
  15. std::cout << spaceless << '\n';
  16. }
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 4188KB
stdin
I am the very model of a modern major general
stdout
I
Iam
Iamthe
Iamthevery
Iamtheverymodel
Iamtheverymodelof
Iamtheverymodelofa
Iamtheverymodelofamodern
Iamtheverymodelofamodernmajor
Iamtheverymodelofamodernmajorgeneral