#K6096. Longest Distinct Substring
Longest Distinct Substring
Longest Distinct Substring
The problem is about finding the length of the longest substring with all distinct characters. Given a string S consisting of only lowercase alphabetical characters, you are required to determine the maximum length of a substring in which all characters are unique.
Mathematically, if S is the given string, you need to compute: $$\max_{0 \leq i \leq j < |S|} (j-i+1) \text{ such that all characters in } S[i \ldots j] \text{ are distinct}$$.
inputFormat
A single string S consisting only of lowercase alphabetical characters is provided via standard input.
outputFormat
An integer representing the length of the longest substring with distinct characters is printed to standard output.## sample
abcabcbb
3