fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. string s;
  7. getline(cin,s);
  8. stringstream ss;
  9. vector<int> v;
  10. ss << s;
  11. int a;
  12. while(ss >> a)
  13. {
  14. v.push_back(a);
  15. }
  16.  
  17. cout << v.size() << endl << endl;
  18.  
  19. for(int i = 0; i < v.size(); i++)
  20. cout << v[i] << endl;
  21.  
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 15240KB
stdin
12 45 478 12 6 5 7
stdout
7

12
45
478
12
6
5
7