Stack

16.2 - Stack basic 2


Continuing from the previous program, your task is now to make the program issue a warning when an asterisk is inputted while the stack is empty. The program should print out a newline, "Stack is empty", and another newline, then it should ignore the asterisk's effect and move on to the next character.

Sample input

a b * * * c * *

Sample output

b a 
Stack is empty
c 
Stack is empty