Python 3   ||   9 lines,  map & pairwise   ||   T/S: 90% / 80%
Pretty much the typical solution, but initially mapping the characters in word to their ord before executing the algorithm.\n\nclass Solution:\n    def removeAl
Pretty much the typical solution, but initially mapping the characters in word to their `ord` before executing the algorithm.\n```\nclass Solution:\n    def removeAlmostEqualCharacters(self, word: str) -> int:\n        \n        word = map(ord,word)\n        adj_eq, ans = False, 0\n\n        for a,b in pairwise(word):\n            if adj_eq or abs(a-b) > 1:\n                adj_eq = False\n                continue\n\n            adj_eq = True\n            ans+= 1\n        \n        return ans\n```\n[https://leetcode.com/problems/remove-adjacent-almost-equal-characters/submissions/1295272867/](https://leetcode.com/problems/remove-adjacent-almost-equal-characters/submissions/1295272867/)\n\nI could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(1), in which *N* ~ `len(word)`.\n\n\n\n
['Python3']