O(n) Solution  😀
\n\n# Code\n\nclass Solution:\n    def removeAlmostEqualCharacters(self, word: str) -> int:\n        ans=0\n        ind=1\n        def com(a,b):\n            if
\n\n# Code\n```\nclass Solution:\n    def removeAlmostEqualCharacters(self, word: str) -> int:\n        ans=0\n        ind=1\n        def com(a,b):\n            if a==b or abs(ord(a)-ord(b))==1:return True\n            return False\n        while ind<len(word):\n            if com(word[ind],word[ind-1]):\n                ind+=2\n                ans+=1\n            else:ind+=1\n        return ans\n```
['Python3']