BEATS 100% EASY JAVA SOLN
Intuition\nThe code aims to count pairs of characters that are equal, have a difference of 1, or a difference of -1 in their ASCII values, as they can be remove
# Intuition\nThe code aims to count pairs of characters that are equal, have a difference of 1, or a difference of -1 in their ASCII values, as they can be removed to make the word nearly equal.\n\n# Approach\nBy iterating through the word and comparing adjacent characters based on their ASCII values, the code counts pairs that can be removed to make the word nearly identical.\n\n# Complexity\nThe time complexity is O(n), where \'n\' is the length of the input word. The algorithm iterates through the word once to compare adjacent characters.\n\nThe space complexity is O(1) since the algorithm uses a constant amount of extra space regardless of the input size, maintaining only a few variables for counting and iteration.\n# Code\n```\nclass Solution {\n    public int removeAlmostEqualCharacters(String word) {\n        int ct=0;\n        for(int i=0;i<word.length()-1;i++)\n        {\n            if(word.charAt(i)+1==word.charAt(i+1)||word.charAt(i)==word.charAt(i+1)||word.charAt(i)-1==word.charAt(i+1))\n        {\n            ct++;\n            i++;\n        }\n        }\n        return ct;\n    }\n}\n```
['Java']