#C14246. Longest Unique Substring

    ID: 43874 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

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

This problem requires you to use efficient techniques such as the sliding window method to check for duplicates within a substring.

Hint: Use a hash table or dictionary to store the index of previously seen characters and update the window accordingly.

The mathematically defined solution can be framed as:

\(ans = \max_{0 \leq i \leq j < n} (j - i + 1)\) such that \(s[i], s[i+1], \dots, s[j]\) are all distinct.

inputFormat

The input consists of a single line containing the string s. The string can be empty and may contain any printable characters.

outputFormat

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

## sample
0