String with Most Unique CharactersMedium

String with Most Unique Characters

MediumPractice library · +20 XPstringssliding windowhash map

Given a string S, find the length of the longest substring of S that contains only unique characters. If there are multiple such substrings of the maximal length, return the one that appears earliest in S.

Input

The first line contains a string S.

Output

Print a single integer representing the length of the longest substring with unique characters.

Constraints

1 <= |S| <= 200000. S consists of lowercase English letters.

Time limit 1 s (native code; slower languages get more)Memory 256 MB14 hidden tests

Example 1

Input
abcabcbb
Output
3

The longest substring with unique characters is 'abc', length 3.

Example 2

Input
bbbbb
Output
1

The longest substring with unique characters is 'b', length 1.

Hints