#C9570. Longest Substring Without Repeating Characters

    ID: 53678 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string \(s\), find the length of the longest substring that does not contain any repeating characters. In other words, you need to compute the maximum length \(L(s)\) such that there exists a substring \(s[i \ldots j]\) with all unique characters. This can be formally written as:

[ L(s) = \max_{0 \le i \le j < n} { j - i + 1 \mid s[i], s[i+1], \ldots, s[j] \text{ are all distinct} } ]

Your task is to output the integer value of \(L(s)\) for the given input string.

inputFormat

The input consists of a single line containing a non-empty string \(s\). The string can consist of any visible ASCII characters.

outputFormat

Output a single integer, which is the length of the longest substring of \(s\) that does not contain any repeating characters.

## sample
abcabcbb
3