simple c++ solution beats 100%
Intuition\nThe idea is to use a flag and traverse along the length of the string.\n\n# Approach\n\n\n\n# Complexity\n- Time complexity: O(n)\n Add your time com
# Intuition\nThe idea is to use a flag and traverse along the length of the string.\n\n# Approach\n\n\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int removeAlmostEqualCharacters(string word) {\n        int operations = 0;\n        bool flag = false;\n        \n        for(int i = 1; i<word.size(); i++){\n            if(!flag && (abs(word[i] - word[i-1]) <= 1)){\n                flag = true;\n                operations++;\n            }\n            else{\n                flag = false;\n            }\n        }\n        return operations;\n    }\n};\n```
['C++']