[Python] Three liner solution beats 98% in time using dictionary.
\n\nclass Solution:\n    def maxLengthBetweenEqualCharacters(self, s: str) -> int:\n        letter,res  = defaultdict(list),[]\n        for i in range(len(s)):l
![image](https://assets.leetcode.com/users/images/6bfa6ff4-f4c7-47e5-9895-78a5aa19729c_1603773123.650697.png)\n```\nclass Solution:\n    def maxLengthBetweenEqualCharacters(self, s: str) -> int:\n        letter,res  = defaultdict(list),[]\n        for i in range(len(s)):letter[s[i]].append(i)\n        for j in letter.values():res.append(j[-1]-j[0]-1)\n        return max(res)\n       \n```
['Python', 'Python3']