#C12706. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string S consisting of printable characters, find the longest substring of S that contains no repeating characters. If there are multiple substrings with the same maximum length, return the one that appears first in S. The solution must run in \(O(n)\) time complexity, where \(n\) is the length of the string.
Example:
Input: abcabcbb Output: abc</p>Input: bbbbb Output: b
Input: pwwkew Output: wke
inputFormat
The input consists of a single line containing the string S. The string is provided via standard input (stdin).
outputFormat
Print the longest substring without repeating characters to the standard output (stdout). In the case of a tie, print the substring that appears first in S.## sample
abcabcbb
abc