Java | beats 100%
Code
\n\n# Code\n```java []\nclass Solution {\n    public int removeAlmostEqualCharacters(String word) {\n        int len = word.length();\n        char[] ch = word.toCharArray();\n        int[] dp = new int[len];\n\n        int count = 0;\n\n        for(int i = 1; i < len; i+=2) {\n            int prev = i - 1;\n            int next = i + 1;\n            \n            char c = ch[i];\n            char p = ch[prev];\n\n\n            if(dp[i] == 0 && dp[i - 1] == 0 && (c == p || Math.abs(p - c) == 1)) {\n                count++;\n                dp[i] = 1;\n                dp[i - 1] = 1;\n                continue;\n            }\n\n            if(next < len && dp[i] == 0 && dp[i + 1] == 0) {\n                char n = ch[next];\n                if(c == n || Math.abs(n - c) == 1) {\n                    count++;\n                    dp[i] = 1;\n                    dp[i + 1] = 1;\n                }\n            }\n        }\n\n        return count;\n    }\n}\n```
['Java']