Simple solution using stack C++
Iterate through the input string.(curr is the current character)\n\nIf the stack is empty push curr into the stack.\nelse if the stack top is same as curr, pop 
Iterate through the input string.(curr is the current character)\n\nIf the stack is empty push curr into the stack.\nelse if the stack top is same as curr, pop the stack once.\nelse push curr into the stack.\n\nFinally the elements in the stack is the answer in reverse order.\n\nTry understanding with input :cabba\n\ncurr=c: stack=[c\ncurr=a: stack=[ca\ncurr=b: stack=[cab\ncurr=b: stack=[ca\ncurr=a: stack=[c\n\nans:c\n\n```\nstring removeDuplicates(string a) {\n\tstack<char> st;\n\tstring ans="";\n\tfor(auto curr:a) {\n\t\tif(st.empty()) st.push(curr);\n\t\telse if(st.top() == curr) st.pop();\n\t\telse st.push(curr);\n\t}\n\n\twhile(!st.empty()) {\n\t\tans += st.top();\n\t\tst.pop();\n\t}\n\n\treverse(ans.begin(), ans.end());\n\n\treturn ans;\n}\n```
['Stack', 'C']