fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <sstream>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. vector<string> words;
  10. string line, tmp;
  11. getline(cin, line);
  12. istringstream iss(line);
  13. while (iss >> tmp) {
  14. words.push_back(tmp);
  15. }
  16.  
  17. for (auto it = words.begin(); it != words.end(); ++it) {
  18. cout << *it << endl;
  19. }
  20. }
  21.  
Success #stdin #stdout 0s 3436KB
stdin
123 456 789
stdout
123
456
789