#K45752. Longest Unique Substring

    ID: 27823 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string s, your task is to find and print the longest substring of s that contains no repeating characters.

For example, if the input string is abcdef, the longest unique substring is abcdef. In the case of pwwkew, the answer would be wke.

Formally, if we denote the input string as \(s\) of length \(n\), you are required to find indices \(i\) and \(j\) with \(0 \leq i \leq j < n\) such that the substring \(s[i:j+1]\) has all distinct characters and its length \(j-i+1\) is maximized.

If there are multiple answers, you may output any one of them.

inputFormat

The input consists of a single line containing a non-empty string s (which may be empty as well), where \(s\) only contains ASCII characters.

You should read the input from standard input (stdin).

outputFormat

Output the longest substring of s that has all distinct characters. The answer should be printed to standard output (stdout).

## sample
abcdef
abcdef