C++ Simple and Short One Pass Solution, 0ms Faster than 100%
\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(string s) {\n        vector<int> v(26, -1);\n        int maxi = -1;\n        \n        for 
```\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(string s) {\n        vector<int> v(26, -1);\n        int maxi = -1;\n        \n        for (int i = 0; i < s.size(); i++) {\n            if (v[s[i] - \'a\'] == -1) v[s[i] - \'a\'] = i;\n            else maxi = max(maxi, abs(v[s[i] - \'a\'] - i) - 1);      \n        }\n        \n        return maxi;\n    }\n};\n```\n**Like it? please upvote!**
['C']