3174. Clear Digits
Description
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.
Example 1:
1 | Input: s = "abc" |
Example 2:
1 | Input: s = "cb34" |
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.
Hints/Notes
- Biweekly Contest 132
Solution
Language: C++
1 | class Solution { |