fork download
  1. #include <sstream>
  2. #include <iostream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7. std::string line;
  8. while (std::getline(std::cin, line))
  9. {
  10. std::istringstream is(line);
  11. std::string word;
  12.  
  13. while (is >> word)
  14. std::cout << word << '\n';
  15. }
  16. }
  17.  
Success #stdin #stdout 0s 3480KB
stdin
Jack and Jill went up the hill
To fetch a pail of water.
Jack fell down and broke his crown,
And Jill came tumbling after.
stdout
Jack
and
Jill
went
up
the
hill
To
fetch
a
pail
of
water.
Jack
fell
down
and
broke
his
crown,
And
Jill
came
tumbling
after.