easy Java stack solution w/ comments
java\nclass Solution {\n    public String removeDuplicates(String S) {\n        //create stack\n        Stack<Character> stack = new Stack();\n        \n       
```java\nclass Solution {\n    public String removeDuplicates(String S) {\n        //create stack\n        Stack<Character> stack = new Stack();\n        \n        //iterate thru string\n        for (char c : S.toCharArray()) {\n            //check if top of stack is equal to this character\n            if (!stack.isEmpty() && stack.peek() == c) {\n                //remove\n                stack.pop();\n            } else {\n               //add to stack\n                stack.push(c);\n            }\n        }\n        \n        //string builder for result\n        StringBuilder sb = new StringBuilder();\n        \n        //empty stack out (everything left is not an adjacent duplicate)\n        while (!stack.isEmpty()) sb.append(stack.pop());\n        \n        //result\n        return sb.reverse().toString();\n    }\n}\n```
['Stack', 'Java']