100% FASTER || HASHING || UNORDERED MAP
100% FASTER || O(N) SOLUTION\nSimply storing index of first occrance and then maintining a vector containig all substring ending with that char. At last we find
100% FASTER || O(N) SOLUTION\nSimply storing index of first occrance and then maintining a vector containig all substring ending with that char. At last we find max length substring\n\n    int maxLengthBetweenEqualCharacters(string s) {\n        unordered_map<char,pair<int,int>>mp;    // idx, count\n        int i, j=0 , n=s.size();\n        vector<string> ans;       // substrings\n        for(i=0 ; i<n ; i++ ){\n            if(mp.find(s[i])==mp.end()){\n                mp[s[i]]={i,1};\n            }\n            else {\n                j=mp[s[i]].first;\n                ans.push_back(s.substr(j+1,i-j-1));\n            }\n        }\n        if(ans.size()==0) return -1;\n        int sz=INT_MIN;\n        for( auto ss: ans){\n            int t= ss.size();\n            sz=max(sz,t);\n        }\n        return sz;\n    }
[]