Beats 100.00% of users with C++
\n\n# Complexity\n- Time complexity: n\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# 
\n\n# Complexity\n- Time complexity: n\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 sum=-1;\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                  sum=max(sum,j-i-1);\n              }\n          }\n      } return sum;\n\n    }\n};\n```
['C++']