
Given a string s, return the length of the longest contiguous substring that contains no repeated characters. The input is a single 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: The longest substring without repeating characters is "wke".
0 <= len(s) <= 10^5s consists of ASCII 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"Output3WhyOne longest valid substring is "wke", which has length 3.0 <= len(s) <= 10^5s consists of ASCII letters, digits, symbols, and spacesA valid solution should run in linear timedef length_of_longest_substring(s):