fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5. int main() {
  6. std::vector<std::string> vec;
  7. std::string s;
  8. while(std::cin >> s && s != "#") {
  9. vec.push_back(s);
  10. }
  11.  
  12. // Print contents.
  13. for (const auto& s : vec) {
  14. std::cout << s << std::endl;
  15. }
  16. }
Success #stdin #stdout 0s 3436KB
stdin
This is a line containing words and whitespace # this should not be read
stdout
This
is
a
line
containing
words
and
whitespace