[Java] Easy Solution , Fast and Memory Efficient
```\nchar[] ch = new char[S.length()];\n        int i = 0;\n        \n        for(int j = 0; j < S.length(); j++){\n            if(i > 0 && ch[i - 1] == S.charA
```\nchar[] ch = new char[S.length()];\n        int i = 0;\n        \n        for(int j = 0; j < S.length(); j++){\n            if(i > 0 && ch[i - 1] == S.charAt(j)){\n                i--;\n            }\n            else{\n                ch[i] = S.charAt(j);\n                i++;\n            }\n        }\n        return new String(ch, 0, i);
['String', 'Java']