Given a string s, return the length of the longest substring that contains no repeated characters.
A substring is a contiguous run of characters within the string.
Examples
Example 1
- Input
- s = "abcabcbb"
- Output
- 3
- Why
- "abc" is the longest run without repeats.
Example 2
- Input
- s = "bbbbb"
- Output
- 1
Example 3
- Input
- s = "pwwkew"
- Output
- 3
- Why
- "wke" has length 3.
Constraints
0 <= s.length <= 5 * 10^4smay contain letters, digits, symbols and spaces.