# Problem Statement
You are given a string `s`.
Your task is to remove **all** digits by doing this operation repeatedly:
- Delete the _first_ digit and the **closest** **non-digit** character to its _left_.
Return the resulting string after removing all digits.
**Note** that the operation _cannot_ be performed on a digit that does not have any non-digit character to its left.
## 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.
# Solution
My solution to his problem is to use a [[stack]] (which will contain the non-digits). For each character in the input string, we check if it is a digit. If it isn't a digit, we append i onto the stack. If it is a digit, we do not append it to the stack and instead pop the stack, which will remove the last non-digit character. Finally we [[Python join|join]] the stack and return the resulting string.
```python
stack = []
for char in s:
if char.isdigit():
stack.pop()
else:
stack.append(char)
return "".join(stack)
```
Time Complexity: O$(n)$ | Space Complexity O$(n)$