#C5397. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string ( s ), find the longest contiguous substring that contains only unique characters. In other words, you are to determine the maximum-length segment of ( s ) such that no character is repeated within that segment. If there are multiple substrings with the maximum length, return the first one encountered in ( s ). This problem tests your ability to implement efficient string manipulation and sliding window techniques.
inputFormat
The input consists of a single line containing the string ( s ). The string might include spaces and all printable characters.
outputFormat
Output the longest contiguous substring of ( s ) that contains all unique characters. If there are multiple such substrings with maximum length, output the one that appears first.## sample
abcabcbb
abc