c++ solution || O(N) || Dry run included
\nclass Solution {\npublic:\n    string removeDuplicates(string s) {\n        int n=s.size(),i=0;\n        for(int j=0;j<n;++i,++j){\n            s[i]=s[j];\n  
```\nclass Solution {\npublic:\n    string removeDuplicates(string s) {\n        int n=s.size(),i=0;\n        for(int j=0;j<n;++i,++j){\n            s[i]=s[j];\n            if(i>0 and s[i-1]==s[i])\n                i-=2;\n        }\n        return s.substr(0,i);\n    }\n};\n// a b b a c a , i=0,j=0\n// a b b a c a , i=1,j=1\n// a b b a c a , i=2,j=2 -> i-=2,j=2\n// a a b a c a , i=0,j=3\n// c a b a c a , i=0, j=4\n// c a b a c a, i=1,j=4\n// i=2,j=5 -> ans = ca\n```
['String', 'C', 'C++']