#C8442. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string s consisting of lowercase alphabetical characters and spaces, your task is to find the longest contiguous substring that contains all unique characters. In case there are multiple substrings with the same maximum length, return the one that appears first.
This problem can be described mathematically as follows: Given a string \( s \) of length \( n \), find indices \( i \) and \( j \) (with \( 0 \leq i \leq j < n \)) such that the substring \( s[i:j+1] \) has no repeating characters and its length \( j - i + 1 \) is maximized. In the event of ties, choose the substring with the smallest starting index \( i \).
inputFormat
The input consists of a single line containing the string s. The string may include lowercase alphabetical characters and spaces.
outputFormat
Output a single line containing the longest contiguous substring of s that has all unique characters. If multiple answers are possible, output the one that appears first.
## sampleabcabcbb
abc
</p>