#1624 Python 3 fast functional one-liner, explained
For each character ch that occurs in s one or more times the length of the longest contained substring equals to s.rfind(ch) - s.find(ch) -1. If a character occ
For each character `ch` that occurs in `s` one or more times the length of the longest contained substring equals to `s.rfind(ch) - s.find(ch) -1`. If a character occurs only once at position `x` this expression equals to ` x - x - 1 = -1`. The solution is largest of all longest contained substring lengths for the elements of `set(s)`:\n```\nclass SolutionI:\n    def maxLengthBetweenEqualCharacters(self, s: str) -> int:\n        return max(s.rfind(ch) - s.find(ch) - 1 for ch in set(s))\n```\n\nTime complexity: **O(n)**; Space complexity: **O(1)**
['Python3']