← back to unit
Medium
# stacks medium
The Sticky Keyboard
This keyboard types fine, but the # key is actually BACKSPACE. What did the message really say? ⌨️
You get the raw typed string, where # deletes the previous surviving character (extra #s on empty do nothing). Print the final message (or nothing if it's all erased).
Example:
Input: typed = "hel#lo"
Output: helo
h, e, l get pushed. # pops the l. Then l, o get pushed — leaving h, e, l, o, which spells helo.
💡 need a hint?
stk-sticky-keyboard.py🔒 given lines are locked — write your code in between
loading...