Easy APPROACH using STACK || BEGINNERS FRIENDLY
T.C =O(N)\nS.C =O(N) Because of stack\n\nclass Solution {\npublic:\n    string removeDuplicates(string s) {\n        stack<char>st;\n        string ans="";\n   
**T.C =O(N)\nS.C =O(N) Because of stack**\n```\nclass Solution {\npublic:\n    string removeDuplicates(string s) {\n        stack<char>st;\n        string ans="";\n        \n        for(int i=0;i<s.size();i++){\n            if(st.empty()){\n                st.push(s[i]);\n            }\n            else if(s[i]==st.top()){\n                st.pop();\n            }\n            else{\n                st.push(s[i]);\n            }\n        }\n        while(!st.empty()){\n            ans.push_back(st.top());\n            st.pop();\n        }\n         reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```\n![image](https://assets.leetcode.com/users/images/e93c3100-4795-4d44-a542-fc2fb2572896_1685588124.7269132.jpeg)\n
['String', 'Stack', 'C', 'C++']