Untitled
unknown
plain_text
2 months ago
364 B
4
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