using Recursion
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int t[102];\n    //Arrays.fill(t,-1);\n    Solution() {\n        memset(t, -1, sizeof(t));\n    }\n    int func(string word , int n){\n        if(n<=0) return 0;\n        if(t[n]!=-1){\n            return t[n];\n        }\n        if(word[n]==word[n-1] || word[n]-word[n-1]==1 || word[n]- word[n-1]==-1){\n            return t[n]=max(1+func(word , n-2) , func(word , n-1));\n        }\n        else {\n            return t[n]=func(word , n-1);\n        }\n\n    }\n    int removeAlmostEqualCharacters(string word) {\n        return func(word , word.length()-1);\n    }\n\n    //return t[n];\n};\n```
['C++']