#C14704. Longest Substring Without Repeating Characters

    ID: 44383 Type: Default 1000ms 256MiB

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, your task is to find the longest substring of s that does not contain any repeating characters. For example, if s = "abcabcbb", one of the possible answers is "abc". If there are multiple answers, return the one which appears first while scanning from left to right.

The problem can be formally expressed as: Given a string \(s\) of length \(n\), find a substring \(s[i \ldots j]\) such that all characters in \(s[i \ldots j]\) are unique and \(j - i + 1\) is maximized.

inputFormat

The input consists of a single line containing the string s. The string may be empty. All characters in s are printable ASCII characters.

outputFormat

Output the longest substring of s that has no repeating characters. The output should be printed as a string on a single line.

## sample
abcabcbb
abc