# stacks medium

Undo!

Every artist's favorite button. Each action lands on the history pile; undo erases the most recent one. 🎨

You get actions β€” either a real action word or undo (never more undos than actions available). Print the surviving actions in order, comma-separated, or nothing.

Example:

Input: actions = ["draw", "erase", "undo", "paint"] Output: draw,paint

draw and erase get pushed, undo pops erase back off, then paint gets pushed β€” leaving draw,paint.

πŸ’‘ need a hint?

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