Implement the stack data structure. Write a program that provides a description of the stack and models its operation by implementing all the methods given. The program reads sequential commands and performs the corresponding operation based on the command. After executing each command, the program should return a line. The possible commands for the program are:
push n - Add number n to the stack (the value of n is given after the command). The program should return ok.
pop - Remove the last element from the stack. The program should return its value.
back - The program should return the last element without removing it.
size - The program should return the number of elements in the stack.
clear - The program should clear the stack and return ok.
exit - The program should return bye and terminate.
Before executing back and pop commands, the program should check if there is at least one element in the stack. If the back or pop commands are given in the input and the stack is empty at that time, the program should return the line error.
Described in the statement. See also the input example.
Given in the statement. See also the output example.
Example 1