Swift solution
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    func removeAlmostEqualCharacters(_ word: String) -> Int {\n        var ind = word.startIndex\n        var result = 0\n        var prev: Character?\n        while ind < word.endIndex {\n            if let prevCh = prev, abs(Int(prevCh.asciiValue!) - Int(word[ind].asciiValue!)) <= 1 {\n                result += 1\n                prev = nil\n            } else {\n                prev = word[ind]\n            }\n            ind = word.index(after: ind)\n        }\n        return result\n    }\n}\n\n```
['String', 'Swift', 'String Matching']