Longest Substring Without Repeating Characters

MediumSliding Window
Next
StringSliding WindowHash Map

Find the length of the longest substring that contains no repeated character.

Input

A single string (letters, digits, symbols and spaces are all possible).

Output

Print the length of the longest substring without repeating characters.

Constraints

1 <= length <= 5 * 10^4

Example 1
Input
abcabcbb
Output
3

abc has length 3.

Example 2
Input
bbbbb
Output
1

Every window with a repeat shrinks to a single b.

Hints

Longest Substring Without Repeating Characters - Medium Sliding Window Problem | Skill Shiksha