C++ O(n)/O(1) concise code
IntuitionTwo pointers variantWe try to find substring starting from index i, as long as possible to make sure the substring consist of almost-equal characters o
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Two pointers variant 

We try to find substring starting from index `i`, as long as possible to make sure the substring consist of almost-equal characters only.

Then, if the length of the substring is `len`, its contribution to the final answer will be `ceil((len-1)/2.0)` 
# 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 []
int removeAlmostEqualCharacters(string word) {
    int ans = 0, N = word.size();
    for (int i=0, j=0; i<N; ) {
        for (j=i+1; j<N; j++) {
            if (word[j-1] != word[j] && abs(word[j] - word[j-1]) != 1)
                break;
        }
        ans += ceil((j - i - 1) / 2.0);
        i = j;
    }
    return ans; 
}
```
['C++']