#C3674. Longest Substring Without Repeating Characters

    ID: 47127 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 without repeating characters. For instance, if the input string is abcabcbb, the longest substring without repeated characters is abc which has a length of 3.

The problem can be mathematically represented as finding the maximum value of the substring length, i.e., \( \max_{0 \leq i \leq j < n} \{ j - i + 1 \: | \: s[i\ldots j] \text{ contains no duplicate characters} \} \).

It is guaranteed that the input string contains only ASCII characters.

inputFormat

The input consists of a single line.

  • A string s which may contain letters, digits, symbols, and whitespace.

outputFormat

Output a single integer representing the length of the longest substring without repeating characters.

## sample
abcabcbb
3