#K8711. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
This problem requires you to find the length of the longest substring of a given string that contains all distinct characters. Given an input string, you must iterate through its substrings and identify the one with the maximum length such that no character repeats within that substring.
The input will consist of multiple lines. Each line, except the termination line, represents a separate test case. The sequence ends when a line with the exact text END is encountered.
For each test case, output the length of the longest substring that consists of distinct characters. For example, for the string "abcabcbb", the answer is 3 (i.e. "abc").
inputFormat
The input consists of multiple lines. Each line (except the last line) contains a string that may include letters, digits, or special characters. The final line will be the string END, which should not be processed.
outputFormat
For each input string (excluding the terminator), output one integer per line representing the length of the longest substring with all distinct characters.
## sampleabcabcbb
bbbbb
pwwkew
END
3
1
3
</p>