#C12631. Longest Substring Without Repeating Characters

    ID: 42080 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, determine the length of the longest contiguous substring that contains no repeating characters.

This problem can be solved efficiently using the sliding window technique.

Mathematically, you need to compute:

$$\max_{0 \leq i \leq j < n} (j - i + 1)$$

subject to the condition that each character in s[i\dots j] is unique.

inputFormat

Input is read from standard input (STDIN). The input consists of a single line containing the string s. The string may be empty.

outputFormat

Output the length of the longest substring without repeating characters to standard output (STDOUT).## sample

abcde
5