#C4069. Longest Substring Without Repeating Characters

    ID: 47566 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 that contains only unique characters. In other words, find the maximum length of a contiguous subsequence of s in which no character repeats.

You should solve the problem using an efficient algorithm (for example, using the sliding window technique). Formally, if we denote a substring by s[i...j], you need to compute the maximum integer L such that there exists an index pair i and j with j - i + 1 = L and all characters in s[i...j] are distinct.

In mathematical terms, let \( f(s) \) be the length of the longest substring of \( s \) with all unique characters. Your task is to compute \( f(s) \) given the input string s.

inputFormat

Input is read from standard input (stdin) and consists of a single line containing the string s. The string may include letters, digits, or other characters.

outputFormat

Output to standard output (stdout) a single integer indicating the length of the longest substring of s that contains all unique characters.

## sample
abcabcbb
3