fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <stack>
  4. using namespace std;
  5.  
  6. int main() {
  7. stack<int> stos;
  8. int liczba;
  9.  
  10. while (cin >> liczba) {
  11. stos.push(liczba);
  12. }
  13.  
  14. while (stos.empty() == false) {
  15. cout << stos.top() << " ";
  16. stos.pop();
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 2880KB
stdin
1 2 3
stdout
3 2 1