easy and fastest solution in c++|| beats 100% codes
\n# Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \nO(N)\n\n- Space complexity:\n Add your space complexity here, e.g. O(n) \nO(1)\n
\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int removeAlmostEqualCharacters(string word) \n    {\n        int change=0;\n        int ans=0;\n        if((abs(word[0]-word[1]))<=1)\n        {\n            change=1;\n            ans=1;\n        }\n\n        int n=word.length();\n        for(int i=2; i<word.length(); i+=2)\n        {\n            // cout<<i<<" ";\n            if((i+1<n)&&((i-1)==change)&&((abs(word[i]-word[i+1]))<=1))\n            {\n                // cout<<"Hello"<<endl;\n                    change=i+1;\n                    ans++;\n            }\n            else if((i-1)!=change)\n            {\n                if((abs(word[i]-word[i-1]))<=1)\n                {\n                    // cout<<i<<" ";\n                    ans+=1;\n                    change=i;\n                }\n                else if((i+1<n)&&(abs(word[i]-word[i+1])<=1))\n                {\n                    change=i+1;\n                    ans++;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']