fork download
  1. #include <iostream>
  2. #include <deque>
  3.  
  4. int main()
  5. {
  6. std::deque<int> tab;
  7. int x = 0;
  8.  
  9. while(std::cin >> x)
  10. tab.push_front(x);
  11.  
  12. for(auto n : tab)
  13. std::cout << n << std::endl;
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3480KB
stdin
1
2
3
4
5
r
stdout
5
4
3
2
1