✅Easy to understand ||🔥100% Beats🔥|| C++✅
\n\n# Code\n\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(string s) {\n        \n        unordered_map<char,int>mp;\n        int ans = -1
\n\n# Code\n```\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(string s) {\n        \n        unordered_map<char,int>mp;\n        int ans = -1;\n\n        for(int i =0;i<s.size();i++){\n\n            if(mp.find(s[i])!=mp.end()){\n                ans = max(ans,i-mp[s[i]]-1);\n            }\n            else{\n                mp[s[i]]=i;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']