Beats 100 % greedy
Intuition\n Describe your first thoughts on how to solve this problem. \nGreedy, only check the alternate character, for change\n\n# Approach\n Describe your ap
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nGreedy, only check the alternate character, for change\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\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(n)\n\n# Code\n```python3 []\nclass Solution:\n    def removeAlmostEqualCharacters(self, word: str) -> int:\n\n        alp = [\'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\', \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\', \'w\', \'x\', \'y\', \'z\']\n        alp_dict = {}\n        alp_index_dict = {}\n\n        for i, value in enumerate(alp):\n            alp_dict[value] = i\n\n        for i, value in enumerate(alp):\n            alp_index_dict[i] = value\n        \n        result = 0\n\n        length = len(word)\n        start = 1\n        while start < length:\n            value = word[start]\n            prev = word[start - 1]\n\n            index= alp_dict[value]\n            prev_index= alp_dict[prev]\n            if value == prev or value == alp_index_dict.get(prev_index -1) or value == alp_index_dict.get(prev_index + 1):\n                print("value--",start, value, prev)\n                result += 1\n                start += 2\n            else:\n                start += 1\n\n        return result\n\n```
['Python3']