#K50282. Longest Substring Without Repeating Characters

    ID: 28830 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

You are given a string s. Your task is to determine the length of the longest substring of s that contains no duplicate characters.

For example, if s = "abcabcbb", then the longest substring without repeating characters is abc, which has a length of 3. Formally, if we denote a substring by s[i...j], you need to find the maximum value of j - i + 1 such that every character in s[i...j] is unique. This can be represented using the formula: $$\max_{0 \le i \le j < n} \{j - i + 1 \mid \text{all characters in } s[i...j] \text{ are distinct}\}.$$

Make sure your solution reads input from stdin and prints the result to stdout.

inputFormat

The input consists of a single line containing the string s whose longest substring without repeating characters you must compute. The string may contain spaces and other printable characters.

outputFormat

Output a single integer representing the length of the longest substring of s that does not contain any repeating characters.

## sample
abcabcbb
3