#C4479. Longest Substring Without Repeating Characters

    ID: 48021 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, your task is to compute the length of the longest substring that does not contain any repeating characters.

The problem can be formulated as follows: Given a string \( s \), find the maximum integer \( m \) such that there exists a contiguous substring \( s[i\dots j] \) of length \( m = j-i+1 \) which contains all unique characters.

For example, if \( s = \texttt{abcabcbb} \), the longest substring without repeating characters is \( \texttt{abc} \) with length 3.

inputFormat

The input consists of a single line containing the string \( s \). The string \( s \) may be empty, and it contains only printable characters.

Input is provided via standard input (stdin).

outputFormat

Output a single integer representing the length of the longest substring of \( s \) that contains no repeated characters. Output should be printed to standard output (stdout).

## sample
abcabcbb
3