Help me in solving STACK16 problem

My issue

how do i get the answer as invalid operation

My code

19132

Learning course: Stacks and Queues
Problem Link: MCQ-2 Practice Problem in Stacks and Queues - CodeChef

@ckorangi_2104
because at operation 5 we are making our stack empty.
and when we call 6th operation it will show invalid operation.