#K92432. Longest Unique Substring

    ID: 38196 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string s, your task is to find the longest substring that consists of consecutive characters, all of which are unique (i.e. no duplicates occur in the substring). In case multiple substrings of maximum length exist, return the one that appears first in s.

For example, if s = "abcabcbb", then the longest substring with all unique characters is "abc".

Note: A substring is a contiguous block of characters in the string.

inputFormat

The input consists of a single line containing the string s (which may be empty). The string will contain only printable ASCII characters.

Input format (stdin):

s

outputFormat

Output the longest substring of consecutive unique characters. If the input string is empty, output an empty string.

Output format (stdout):

result
## sample
abcabcbb
abc