Page not loading? Try clicking here.
Placeholder

#1102

Stack 1s 32MB

Problems

A Stack literally means a "pile."

It is a word used for a pile of books, newspapers, etc.

For example, consider a pile of books. When you stack books, the most natural way to take a book from the pile is to take the one on the top.

In other words, the book that was placed first will be the last to be taken out.

In this way, data is stacked at the bottom (input), and when retrieving data (output), the most recent (top) data is taken. A data structure with this behavior is called a Stack.

Because of this characteristic, a Stack is often referred to as FILO (First-In-Last-Out) or LIFO (Last-In-First-Out).


Design a Stack as shown in the diagram and produce output according to the following rules.

Rules:

  1. "i a" — Push the number a onto the stack. Here, a is a natural number not exceeding 10,000.

  2. "o" — Pop the top data from the stack and print it. If the stack is empty, print "empty".

  3. "c" — Print the number of elements currently in the stack.


Input

The first line contains N, the number of commands. (1 ≤ N ≤ 100)

The next N lines each contain a command, one per line.


Output

Print the result for each command that produces output, one per line.

If a command does not produce output, nothing should be printed.


Example

7

i 7
i 5
c
o
o
o
c
2

5
7
empty
0


Source

JUNGOL

You must sign in to write code.