
In Messenger, you need to analyze a typed message and find the length of the longest contiguous substring that contains no repeated characters.
Write a function that takes a string s and returns an integer: the maximum length of any substring of s with all unique characters.
sExample 1
s = "abcabcbb"3"abc", "bca", and "cab", each of length 3.Example 2
s = "bbbbb"1b, so the best answer is "b".Example 3
s = "pwwkew"3"wke" is a valid substring of length 3. "pwke" is not valid because it is not contiguous.0 <= len(s) <= 5 * 10^4s contains English letters, digits, symbols, and spaces