BEATS 100% CLEAR AND CONCISE SOLUTION USING MAP
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(N)\n- Space complexity:\nThe space complexity is (N)\n\n# Code\n```\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(std::string s) {\n        int maxi = -1, n = s.size();\n        unordered_map<char, int> mp;\n        for (int i = 0; i < n; i++) {\n            if (mp.find(s[i]) == mp.end())mp[s[i]]=i;\n             else{\n                int start = mp[s[i]],end = i;\n                maxi = max(maxi, end - start - 1);\n            }\n        }\n        return maxi;\n    }\n};\n\n```
['C++']