Easy and simple Java code using Stack and StringBuilder. Easy to Understand
\npublic String removeDuplicates(String s) {\n        Stack<Character> stack = new Stack<>();\n        for(int i=0; i<s.length(); i++){\n            if(!stack.e
```\npublic String removeDuplicates(String s) {\n        Stack<Character> stack = new Stack<>();\n        for(int i=0; i<s.length(); i++){\n            if(!stack.empty()){\n                if(stack.peek().equals(s.charAt(i))){\n                    stack.pop();\n                }else{\n                    stack.push(s.charAt(i));\n                }\n            }\n            else{\n                stack.push(s.charAt(i));\n            }\n        }\n        StringBuilder sb = new StringBuilder();\n        while(!stack.empty()){\n            sb.append(stack.pop());\n        }\n        return sb.reverse().toString();\n    }\n```
['Stack', 'Java']