#K48522. Longest Unique Substring

    ID: 28439 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string (s) consisting of alphanumeric characters, your task is to determine the length of the longest substring that contains no repeated characters. A substring is defined as a contiguous sequence of characters within the string. For instance, for (s = \text{'abcabcbb'}), the longest substring without repeating characters is ('abc') having a length of 3. This problem can be efficiently solved using the sliding window technique with an overall time complexity of (O(n)).

inputFormat

Input is read from (stdin). The input consists of a single line which contains a string (s) (possibly empty) composed of alphanumeric characters.

outputFormat

Output to (stdout) a single integer representing the length of the longest substring that contains all unique characters.## sample

abcabcbb
3