Find the longest stretch of s that has no repeated character, and return its length. A stretch here means a substring: characters that sit side by side in s.
smay hold any single characters: letters, digits, spaces, punctuation and so on.- Upper and lower case are different characters, so
"a"and"A"don't clash. - An empty string gives
0. scan be up to 100,000 characters long, and the answer can be long too.
Input: s = "abacdb"
Output: 4"bacd" and "acdb" both have 4 different characters.
Input: s = "zzzz"
Output: 1
Input: s = "abba"
Output: 2