Simple Stack
Design and implement the data structure "stack". Write the program to simulate the stack operations, implement all methods mentioned below. The program reads the sequence of commands and executes the corresponding operation. After processing each command the program must print one line of output. The possible commands are:
push n — Add to the stack the number (value is given after the command). Print ok.
pop — Remove the last element from the stack. Print the value of this element.
back — Print the value of the last element, not removing it from the stack.
size — Print the number of elements in the stack.
clear — Clear the stack and print ok.
exit — Print bye and terminate.
It is guaranteed that the set of input commands satisfies the following requirements: the maximum number of elements in the stack at any time does not exceed , all commands pop and back are correct, that is, when executed the stack contains at least one element.
Input
Each line contains a single command.
Output
For each command print on a separate line the corresponding result.