Online Programming Server

Login

Login with facebook [?]

Facebook

Problem 1111: Data Structure - Stack

Problem ID 1111
Title Data Structure - Stack
pdf  
Description
Stack is a basic data structure. Read tutorial for more details. Your task is to implement a stack.
Input
The first line contains an integer N (1 ≤ N ≤ 30000), the number of operations.
The follow N lines contains one of the below operation:

Push x - push x into the stack, x is an signed 32-bit integer
Pop - perform stack's pop. If the queue is empty, skip this operation
Output
Print the content of the stack after all operations, from bottom to top.
Sample Input
5
Push 3
Push 4
Pop
Push 2
Push 7
Sample Output
3 2 7
Hint
 
Last Modified 2012-08-20 17:38:38
Time Limit 1 seconds
Memory Limit 32 MB
Accepted Solutions 0
Submitted Solutions 1
Difficulty Factor 235