O(N) Simple Easy Solution || Two Pointer || C++
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int removeAlmostEqualCharacters(string word) {
        int ans = 0;
        int i = 0, j = 1;
        int n = word.length();
        if(n == 1)return 0;

        while(j < n){
            int a = word[i] - '0', b = word[j] - '0';
            if(a == b || a + 1 == b || a == b + 1){
                ans++;
                i += 2, j += 2;
            }
            else {
                i++;
                j++;
            }
        }
        return ans;
    }
};
```
['C++']