[c++][faster than 100%][easy understanding]
\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(string s) {\n        vector<int> mp(26,0);\n        int maxi=-1;\n        for(int i=0;i<s.s
```\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(string s) {\n        vector<int> mp(26,0);\n        int maxi=-1;\n        for(int i=0;i<s.size();i++){\n            if(mp[s[i]-\'a\']) \n\t\t\t     maxi=max(maxi,(i-mp[s[i]-\'a\']));\n            else \n\t\t\t     mp[s[i]-\'a\']=i+1; \n        }\n        return maxi;\n    }\n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++']