Easy [Java] solution using Stack /Loop || separate solution || easy to understand
Using Loop\n\nclass Solution {\n    public String removeDuplicates(String s) {\n        StringBuilder sb=new StringBuilder(s);\n        int len=sb.length();\n  
# Using Loop\n```\nclass Solution {\n    public String removeDuplicates(String s) {\n        StringBuilder sb=new StringBuilder(s);\n        int len=sb.length();\n        for(int i=0;i<sb.length()-1;i++){\n            char c1=sb.charAt(i);\n            char c2=sb.charAt(i+1);\n            if(c1==c2){\n                sb.delete(i,i+2);\n                i=i==0?i-1:i-2;\n            }\n        }\n        return sb.toString();\n    }\n}\n```\n# Using Stack\n```\nclass Solution {\n    public String removeDuplicates(String s) {\n      Stack<Character> st=new Stack<>();\n      for(int i=0;i<s.length();i++){\n          char c=s.charAt(i);\n          if(st.isEmpty()){\n              st.push(c);\n          }\n          else if(st.peek()==c){\n              st.pop();\n          }\n          else{\n              st.push(c);\n          }\n      }\n      String ans=new String("");\n        while(!st.isEmpty()){\n            ans=st.pop()+ans;\n        }\n      return ans;\n    }\n}\n```
['String', 'Stack', 'Java']