# stacks advanced

Undo and Redo

Undo has a twin: redo. Undone letters wait on a second pile — but typing something NEW scatters them forever. ↩️↪️

You get commandstype:x, undo, redo (undo/redo arrive only when possible). Print the final text, or empty.

Example:

Input: commands = ["type:h", "type:i", "undo", "redo"] Output: hi

h and i get typed, undo moves i to the redo pile, then redo brings i right back — the text ends as hi.

💡 need a hint?

stk-undo-redo.py🔒 given lines are locked — write your code in between
loading...