Naive[Brute force] c++ approach
Complexity\n- Time complexity:O(n^2)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity:O(n^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maxLengthBetweenEqualCharacters(string s) {\n        int ans=-1,x;\n        for(int i=0;i<s.length();i++){\n            for(int j=i+1;j<s.length();j++){\n                if(s[i]==s[j])\n                    x=j-i-1;\n                    ans=max(ans,x);\n                    }\n                }\n        return ans;\n    }\n};\n```
['C++']