Easy and Understandable Solution
\n\n# Approach\n Describe your approach to solving the problem. \nTaking an extra dictionary to store the unique characters and then as soon as getting the same
\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTaking an extra dictionary to store the unique characters and then as soon as getting the same character calculating the distance between the two equal characters.\n# Code\n```\nclass Solution:\n    def maxLengthBetweenEqualCharacters(self, s: str) -> int:\n        last_index={}\n        max_length =-1\n        for i,char in enumerate(s):\n            if char in last_index:\n                max_length= max(max_length,i-last_index[char]-1)\n            else:\n                last_index[char]=i\n        return max_length\n        \n```\n\n# **PLEASE DO UPVOTE!!!\uD83E\uDD79**
['Python3']