#K39932. Longest Unique Substring

    ID: 26530 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Your task is to find the longest substring of a given string that contains no repeating characters. If there is more than one substring with the maximum length, return the one that appears first in the string.

For example:

  • For the input abcabcbb, the longest substring without repeating characters is abc.
  • For the input bbbbb, the answer is b.

The solution should read the input from stdin and print the result to stdout.

inputFormat

The input consists of a single line containing a string s. The string may include spaces and punctuation. The length of the string is between 0 and 10,000.

Input is read from stdin.

outputFormat

Output the longest substring of s that has no repeating characters. The output is printed to stdout.

## sample
abcabcbb
abc