#C14209. Longest Unique Substring

    ID: 43833 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string s, find the length of the longest contiguous substring that contains all distinct characters.

This problem can be solved efficiently using the sliding window technique. For instance, if s = "abcabcbb", the longest unique substring is "abc" which has a length of 3.

The input is read from stdin, and the result should be printed to stdout as a single integer.

The formula for the length of the longest substring is given by: \( L = \max_{0\leq i\leq n-1} (\text{end} - \text{start} + 1) \), where start and end refer to the indices of the current window.

inputFormat

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

outputFormat

Output a single integer which is the length of the longest substring of s with all distinct characters.

## sample
abcabcbb
3