Beats 100% of users with C++ || Simple and easy solution || Full explanation || O(n) time complexity
Easy solution with C++ || Beats 100%\n# Intuition\n Describe your first thoughts on how to solve this problem. \nCheck for the difference between adjacent eleme
# Easy solution with C++ || Beats 100%\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nCheck for the difference between adjacent elements. The count of difference is the answer to the problem.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFind the absolute difference between every two adjacent elements. If the difference is less than or equal to 1, this means that the elements are almost-equal-adjacent so increment the count/ans.\nFinally return the answer.\n\n# Complexity\n- Time complexity:\n    **O(n)**\n- Space complexity:\n    **O(1)**\n# Code\n```\nclass Solution {\npublic:\n    int removeAlmostEqualCharacters(string word) {\n        int ans = 0;\n        for(int i =1; i< word.size(); i++){\n            if(abs(word[i] - word[i-1]) <= 1){\n                ans++;\n                i++;\n            }\n        }\n        return ans;\n    }\n};\n```
['String', 'C++']