Python || Easy || 4 lines code || Beats 98%
\n\n# Complexity\n- Time complexity:\nO(n)\n\n\n Add your space complexity here, e.g. O(n) \n\n# Code\n\nclass Solution(object):\n    def removeAlmostEqualChara
\n\n# Complexity\n- Time complexity:\nO(n)\n\n\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution(object):\n    def removeAlmostEqualCharacters(self, word):\n        """\n        :type word: str\n        :rtype: int\n        """\n        count = 0\n        x = list(word)\n        for i in range(1,len(word)):\n            if ord(x[i]) == ord(x[i-1]) + 1 or ord(x[i]) == ord(x[i-1]) - 1 or ord(x[i]) == ord(x[i-1]):\n                count +=1\n                x[i] = "*"\n        return count\n        \n```
['Python']