Posted on March 8, 2021March 8, 2021 Description Submission class Solution { public: string removeDuplicates(string S) { string ret = ""; for(char c: S) { if(ret.empty()) { ret.push_back(c); continue; } if(c == ret.back()) ret.pop_back(); else { ret.push_back(c); } } return ret; } }; By Bill0412 Easy LeetCode