#C14167. Longest Unique Substring

    ID: 43786 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string consisting of lowercase alphabets, compute the length of the longest substring that contains all unique characters. In other words, find the maximum value of \(L\) such that there exists a substring of length \(L\) in which no character appears more than once.

You are required to implement an efficient solution using the sliding window technique. For a string \(s\) of length \(n\), an optimal solution will run in \(O(n)\) time complexity.

inputFormat

The input consists of a single line containing a string \(s\) composed of lowercase alphabets. Note that the string can be empty.

outputFormat

Output a single integer representing the length of the longest substring with all unique characters.

## sample
0