#K81502. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string S, you are to find the length of the longest substring that does not contain any repeated characters. The challenge is to do this efficiently. Consider the substring as a contiguous block of characters. For example, given S = "abcabcbb", the answer is 3 because the longest substring without repeating characters is "abc".
The problem can be modeled by the following idea: if we denote the length of the desired substring as \( L \), then \( L = \max_{i \leq j}({\text{length of substring } S[i\ldots j]}) \) under the constraint that all characters in \( S[i\ldots j] \) are unique.
inputFormat
The input is provided from standard input (stdin) and consists of a single line containing the string S.
outputFormat
Output the length of the longest substring of S that contains no repeated characters. The output should be written to standard output (stdout).
## sampleabcabcbb
3