#C7035. Longest Substring Without Repeating Characters

    ID: 50862 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string (s), your task is to compute the length of the longest substring that contains no repeated characters. Specifically, if you consider any substring (s[i...j]) where all characters are distinct, you must output the maximum possible length. This problem can be efficiently solved using the sliding window technique. For example, for (s = \texttt{"abcabcbb"}), the longest substring with unique characters is (\texttt{"abc"}) which has a length of 3.

inputFormat

Input is provided via standard input (stdin) as a single line containing the string (s). The string may include spaces and special characters.

outputFormat

Output the length of the longest substring of (s) that contains only distinct characters. The output should be printed to standard output (stdout) as a single integer.## sample

abcabcbb
3