There are five operations provided by a stack are listed as below:
s.empty()
Returns true if the stack is empty; false otherwise.
s.size()
Returns a count of the number of elements on the stack.
s.pop()
Removes, but does not return, the top element from the stack.
s.top()
Returns, but does not remove, the top element on the stack.
s.push(item)
Places a new top element on the stack.
[1]
[2]