#K7761. Longest Unique Substring

    ID: 34903 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string s consisting of lowercase English letters, your task is to find the length of the longest substring without any repeating characters.

In other words, if we define a substring sub of s as a contiguous sequence of characters, you need to compute:

$$ \max_{sub \subset s} |sub| $$

where every character in sub is unique. For example, if s = "abcdabca", the longest such substring is "abcd" with length 4.

This is a typical sliding window problem where you need to efficiently maintain a window of unique characters.

inputFormat

The input consists of a single line containing the string s (only lowercase English letters).

Note: Read the input from standard input (stdin).

outputFormat

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

Note: Write the output to standard output (stdout).

## sample
abcdabca
4