本文最后更新于626 天前,其中的信息可能已经过时,如有错误请发送邮件到tomding1065@gmail.com
CPP
class Solution {
public:
string removeDuplicates(string s) {
string res;
for(char x:s){
if(res.empty()||res.back() != x){
res.push_back(x);
}else{
res.pop_back();
}
}
return res;
}
};