Easy for loop approach
\n# Code\njava []\nclass Solution {\n    public int removeAlmostEqualCharacters(String word) {\n        int count = 0;\n        for (int i = 0; i < word.length(
\n# Code\n```java []\nclass Solution {\n    public int removeAlmostEqualCharacters(String word) {\n        int count = 0;\n        for (int i = 0; i < word.length();) {\n            char c = word.charAt(i);\n            if (i < word.length() - 1) {\n                char p = word.charAt(i + 1);\n                if (c == p || (c + 1) == p || (c - 1) == p) {\n                    count++;\n                    i += 2;\n                } else {\n                    i++;\n                }\n            } else {\n                break;\n            }\n        }\n        return count;\n    }\n}\n\n```
['Java']