Python 96.79% run time  100% memory
\n\nclass Solution:\n    def removeDuplicates(self, S: str) -> str:\n        if not S:\n            return S\n        res = [S[0]]\n        for curr in S[1:]:  
![image](https://assets.leetcode.com/users/jackli2046/image_1585817374.png)\n```\nclass Solution:\n    def removeDuplicates(self, S: str) -> str:\n        if not S:\n            return S\n        res = [S[0]]\n        for curr in S[1:]:            \n            if res and curr == res[-1]:\n                res.pop()\n            else:\n                res.append(curr)\n        res = \'\'.join(res)                \n        return res\n```
['Python', 'Python3']