# stacks easy

The Book Return Cart

Returned books pile up on the cart; the librarian shelves from the top, calling out each title. πŸ“š

You get commands β€” put:title adds a book, shelve removes the top book (always valid). Print each shelved title on its own line, in shelving order.

Example:

Input: commands = ["put:matilda", "put:bfg", "shelve", "put:holes", "shelve", "shelve"] Output:

bfg
holes
matilda

shelve always removes the current top book: first bfg (on top of matilda), then holes, then matilda.

πŸ’‘ need a hint?

stk-book-return-cart.pyπŸ”’ given lines are locked β€” write your code in between
loading...