
Given a string s, return the length of the longest substring that contains no repeated characters. A substring is a contiguous sequence of characters within the string. The input is a string, and the output is a single integer.
Example 1:
Input: s = "abcabcbb"
Output: 3
Explanation: The longest substring without repeating characters is "abc".
Example 2:
Input: s = "bbbbb"
Output: 1
Explanation: The longest substring without repeating characters is "b".
Example 3:
Input: s = "pwwkew"
Output: 3
Explanation: One valid longest substring is "wke".
0 <= len(s) <= 5 * 10^4s consists of English letters, digits, symbols, and spacess = "abcabcbb"Output3WhyThe longest substring without repeated characters is "abc", which has length 3.s = "bbbbb"Output1WhyEvery substring longer than 1 repeats the character "b".s = "pwwkew"Output3Why"wke" is a longest valid substring with no repeated characters.0 <= len(s) <= 5 * 10^4s consists of English letters, digits, symbols, and spacesA valid solution should run in linear timedef length_of_longest_substring(s):