Untitled
unknown
plain_text
10 months ago
364 B
6
Indexable
class Solution {
public:
string clearDigits(string s) {
string ans;
for(int i=0;i<s.size();i++) {
if(s[i] >= '0' && s[i] <= '9') {
if(!ans.empty()) {
ans.pop_back();
}
} else {
ans+=s[i];
}
}
return ans;
}
};Editor is loading...
Leave a Comment