#C7360. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string S, find the length of the longest substring that contains only unique characters. In other words, you must find the maximum length L such that there exists a substring S[i...j] with all distinct characters and L = j - i + 1. The problem can be mathematically represented as finding
\[ L = \max_{0 \leq i \leq j < n} \{ j - i + 1 \;|\; \forall k, l \in [i,j] : s[k] \neq s[l] \text{ for } k \neq l \} \]
This is a common problem that can be efficiently solved using the sliding window technique.
inputFormat
The input is provided via standard input. It consists of a single line containing the string S. Note that S may be empty.
outputFormat
Output the length of the longest substring of S that contains all unique characters. The result should be printed to standard output.
## sampleabcabcbb
3