#K94697. Longest Substring Without Repeating Characters

    ID: 38699 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a non-empty string s consisting of ASCII characters, your task is to determine the length of the longest substring without repeating characters.

Let the input string be \( s \). You need to find the maximum length \( L \) of a substring such that no character appears more than once in that substring.

For example, if \( s = \texttt{abcabcbb} \), then the answer is \( 3 \) because the longest substring without duplicates is \( \texttt{abc} \). Similarly, for \( s = \texttt{bbbbb} \), the answer is \( 1 \).

Input is given via standard input and the result should be written to standard output.

inputFormat

The input consists of a single line containing a non-empty ASCII string.

outputFormat

Output a single integer representing the length of the longest substring without repeating characters.## sample

abcabcbb
3

</p>