You are given a string `s` of lowercase letters and digits. Repeatedly delete the first digit together with the closest non-digit character to its left, until no digits remain. Return the resulting string. The input always allows every digit to be removed this way.
You are given a string s of lowercase letters and digits. Repeatedly delete the first digit together with the closest non-digit character to its left, until no digits remain. Return the resulting string. The input always allows every digit to be removed this way.
Example 1:
Input: {"s":"abc"}
Output: abc
Constraints:
1≤s.length≤100
s consists only of lowercase English letters and digits.
The input is generated such that it is possible to delete all digits.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"s":"abc"}
keystrokes in s: letters type, digits act as ⌫
a
b
c
Treat the string as keystrokes: a letter types itself, a digit works like backspace and deletes the closest letter still on screen to its left. The screen is a stack.