Search for the longest substring without repeating characters
Python
Medium
strings
Task «Search for the longest substring without repeating characters»
Given a string `s` consisting of lowercase Latin letters. Find the length of the longest substring in which all characters are unique (do not repeat). If the string is empty, return 0.
Input Format
The only string s (1 ≤ |s| ≤ 10^5). The string contains only lowercase letters of the Latin alphabet.
Output Format
One integer — the length of the longest substring without repeating characters.
Examples
Example 1
INPUT
abcabcbb
OUTPUT
3
Example 2
INPUT
bbbbb
OUTPUT
1
Example 3
INPUT
5
1 2 3 4 5
5
3 4 5 6 7
OUTPUT
1
Example 4
INPUT
pwwkew
OUTPUT
3
Example 5
INPUT
6
1 1 1 2 2 3
OUTPUT
1
main.py