#C6729. Longest Substring Without Repeating Characters

    ID: 50521 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, your task is to find the length of the longest substring of s that contains no repeated characters. In other words, determine the maximum length of a contiguous subsequence of characters in which every character appears exactly once.

The problem requires a careful traversal of the string using efficient methods, such as the sliding window technique. Consider the case where the input is an empty string; the correct output in such cases is 0.

The answer might be expressed mathematically as follows:

$$ \text{result} = \max_{0 \leq i \leq j \leq n} \{ j - i \; | \; s[i:j] \text{ contains all unique characters} \} $$

Use the standard input/output format to read the string and output the integer result.

inputFormat

The input consists of a single line containing the string s.

Note: The string may contain spaces and other printable characters.

outputFormat

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

## sample
abcdef
6