C++ Solutions
\nclass Solution {\npublic:\n    string removeDuplicates(string s) {\n        stack<char>st;\n        int n = s.size();\n        for(int i=0; i<n; i++){\n      
```\nclass Solution {\npublic:\n    string removeDuplicates(string s) {\n        stack<char>st;\n        int n = s.size();\n        for(int i=0; i<n; i++){\n            if(!st.empty() && st.top() == s[i]) st.pop();\n            else st.push(s[i]);\n        }\n        string ans = "";\n        while(!st.empty()){\n            ans += st.top();\n            st.pop();\n        }\n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```
['C', 'C++']