fork download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <sstream>
  4. #include <string>
  5. #include <vector>
  6.  
  7. std::istringstream iss(
  8. R"('Twas brillig, and the slithy toves
  9. Did gyre and gimble in the wabe;
  10. All mimsy were the borogoves,
  11. And the mome raths outgrabe.
  12.  
  13. "Beware the Jabberwock, my son!
  14. The jaws that bite, the claws that catch!
  15. Beware the Jubjub bird, and shun
  16. The frumious Bandersnatch!"
  17. )");
  18.  
  19.  
  20. using namespace std;
  21.  
  22. int main() {
  23. std::vector<std::string> words((std::istream_iterator<std::string>(iss)),
  24. std::istream_iterator<std::string>());
  25.  
  26. for (auto & word : words)
  27. std::cout << word << '\n';
  28. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
'Twas
brillig,
and
the
slithy
toves
Did
gyre
and
gimble
in
the
wabe;
All
mimsy
were
the
borogoves,
And
the
mome
raths
outgrabe.
"Beware
the
Jabberwock,
my
son!
The
jaws
that
bite,
the
claws
that
catch!
Beware
the
Jubjub
bird,
and
shun
The
frumious
Bandersnatch!"