#C5648. Longest Substring Without Repeating Characters

    ID: 49320 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string \(S\), determine the length \(L\) of the longest substring that contains no repeating characters.

For example, if \(S = \texttt{abcabcbb}\), then the longest substring is \(\texttt{abc}\) with length \(3\). Use an optimal algorithm (such as the sliding window technique) to solve this problem.

The input will be read from standard input and the output should be produced to standard output.

inputFormat

The input consists of a single line containing the string (S). Note that (S) may be empty.

outputFormat

Output a single integer representing the length of the longest substring of (S) that does not contain any repeating characters.## sample

abcabcbb
3