Python3 Solution
\n\nclass Solution:\n    def maxLengthBetweenEqualCharacters(self, s: str) -> int:\n        ans=-1\n        for x,a in enumerate(s):\n            for y,b in enu
\n```\nclass Solution:\n    def maxLengthBetweenEqualCharacters(self, s: str) -> int:\n        ans=-1\n        for x,a in enumerate(s):\n            for y,b in enumerate(s):\n                if a==b and x!=y:\n                    ans=max(ans,abs(x-y)-1)\n        return ans            \n```
['Python', 'Python3']