#C13247. Longest Unique Substring

    ID: 42764 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string s, your task is to find the longest substring that contains no repeating characters. More formally, for a given string ss of length nn, find a substring s[i:j]s[i:j] where all characters are distinct and the length jij-i is maximized. In case there are multiple substrings with the maximum length, return the one that appears first in ss.

inputFormat

The input is given via stdin as a single line containing the string s. The string may include any printable ASCII characters. It is possible that the string is empty.

outputFormat

Output via stdout the longest substring of s that does not contain any repeating characters. If multiple answers exist, output the first one encountered.

## sample