5708 - Stack   

Description

Please implement basic operations of a stack.

 

 

Input

There are a lot of stack operations in the input, including

"push i" means to push i on the stack.

"pop": pop the stack.

"top": output the top of the stack.

 

Output

Whenever a top operation is executed, output the top value of the stack.

If the stack is empty when top is executed, output "X". 

Sample Input  Download

Sample Output  Download

Tags




Discuss