#K53942. Longest Unique Substring

    ID: 29643 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string s, find the longest substring of s that does not contain any repeating characters. In other words, if there exists a substring s[i...j] such that every character in this substring is unique, return the substring with the maximum length. If there are multiple answers with the same length, return the first one found.

This can be mathematically expressed as finding indices \(i\) and \(j\) such that for all \(k, l\) with \(i \le k < l \le j\), the condition $$s[k] \ne s[l]$$ holds true, and the value \(j-i+1\) is maximized.

inputFormat

The input consists of a single line containing the string s. The string is made up of ASCII characters.

outputFormat

Output the longest substring of s that contains no repeating characters.

## sample
abcabcbb
abc