← Back to problems

32. Stack

BEGINNER
BeginnerData StructuresLLDStack

Implement a last-in-first-out stack driven by a command stream.

Implement a stack of integers. Process commands from stdin, one per line. Commands: - PUSH <value> : push an integer onto the top of the stack. - POP : remove and print the top value, or print "EMPTY" if the stack is empty. - PEEK : print the top value without removing it, or "EMPTY" if the stack is empty. - SIZE : print the number of values currently on the stack.
Log in to submit a solution

Comments

Log into join the discussion.