#C13238. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
You are given a string s
. Your task is to find the longest substring of s
that does not contain any repeated characters. If there are multiple substrings with the same maximum length, return the one that appears first.
Note that the input will be provided via standard input (stdin) and the answer must be printed to standard output (stdout). If the input is not a valid string, a ValueError
(or equivalent in other languages) should be raised, but for this problem the input will always be a valid string.
The solution should work efficiently even for larger strings.
inputFormat
The input consists of a single line containing the string s
. The string may contain letters, digits, and special characters.
outputFormat
Output the longest substring of s
that does not contain any repeating characters. If there are multiple substrings with the same length, output the one that appears first.
abcabcbb
abc