repl.it
@AllenLi1/

Stack

C++11

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <bits/stdc++.h>
using namespace std;

int main(int argc, const char * argv[]) {
  stack<int> s;
  int ops, op;
  cin >> ops;
  for (int i = 0; i < ops; i++) {
    cin >> op;
    s.push(op);
  }
  while (!s.empty()) { 
    cout << s.top() << " "; 
    s.pop();
  }
}
Fetching token
?