Untitled
user_9124840
plain_text
a year ago
355 B
10
Indexable
class Solution {
public:
string clearDigits(string s) {
string ans = "";
for (char ch : s) {
if (ch >= '0' && ch <= '9') {
if (!ans.empty()) {
ans.pop_back();
}
} else
ans.push_back(ch);
}
return ans;
}
};Editor is loading...
Leave a Comment