# Remove All Adjacent Duplicates In String (Leetcode 1047)

Problem Link: <https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string/>

```python
class Solution:
    def removeDuplicates(self, string: str) -> str:
        
        s=[]
        
        for i in range(len(string)):
            if(len(s)==0):
                s.append(string[i])
            else:
                if(s[-1]==string[i]):
                    s.pop()
                else:
                    s.append(string[i])
        
        ans=''
        for i in range(len(s)):
            ans=ans+s[i]
        
        return ans
```
