O(n)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nConvert characters with
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nConvert characters with both side equals, then only the ones with one side equal\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```csharp []\npublic class Solution {\n    public int RemoveAlmostEqualCharacters(string word) {\n        char[] ar = word.ToCharArray();\n        int op = 0;\n      for(int i=1; i<ar.Length-1; i++)\n            {\n                if (IsEqual(ar[i-1], ar[i]) && IsEqual(ar[i], ar[i+1]))\n                {\n                    op++;\n                    ar[i] = \'A\';\n                }\n            }\n\n            for(int i=1; i<ar.Length; i++)\n            {\n                if (IsEqual(ar[i-1], ar[i]))\n                {\n                    op++;\n                    ar[i] = \'B\';\n                }\n            }\n        \n        return op;\n    }\n\n    private bool Valid(char[] ar)\n    {\n        for(int i=1; i<ar.Length; i++)\n        {\n            if (IsEqual(ar[i-1], ar[i]))\n            {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    private bool IsEqual(char a, char b)\n    {\n        if (a == b)\n        {\n            return true;\n        }\n        int x = (int)(a - \'a\');\n        int y = (int)(b - \'a\');\n        return Math.Abs(x-y) == 1;\n    }\n}\n```
['C#']