Longest Substring Without RepeatsMedium

Longest Substring Without Repeats

MediumPractice library · +20 XPsliding windowhash mapstrings

Given a string s, find the length of the longest contiguous substring in which no character appears twice.

Input

One line: the string s (lowercase letters and digits).

Output

One integer: the length.

Constraints

  • 1 <= |s| <= 200000
  • s contains only a-z and 0-9
Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests

Example 1

Input
abcabcbb
Output
3

The answer is "abc", length 3.

Example 2

Input
bbbbb
Output
1

Hints