Implement the stack data structure. Write a program that provides the description of the stack and simulates its operation by implementing all the given methods of the stack. The program reads sequential commands and performs various operations depending on the command. After executing each command, the program must output a line. The possible commands for the program are:
push n — Add the number to the stack (the value of 'n' is given after the command). The program should output ok.
pop — Remove the last element from the stack. The program should output its value.
back — The program should output the last element without removing it.
size — The program should output the number of elements in the stack.
clear — The program should clear the stack and output ok.
exit — The program should output bye and terminate.
The input command set is guaranteed to meet the following requirements: the maximum number of elements in the stack at any time does not exceed , all pop and back commands are valid, which means there is at least one element in the stack during their execution.
Explained in the problem statement. See the example of the input data.
Given in the problem statement. See the example of the output data.
Example 1