#C13852. Longest Unique Substring
Longest Unique Substring
Longest Unique Substring
Given a string s, your task is to find the longest substring of s that contains no repeating characters. If there are multiple substrings with the maximum length, return the one that appears first in s.
You need to output two items: the length of this substring and the substring itself. If the input string is empty, output 0.
Note: For any formulas used, please use the LaTeX format. In this problem, you may use the two-pointer (sliding window) technique.
inputFormat
The input is given from stdin and consists of a single line containing the string s.
Example:
abcabcbb
outputFormat
Output the length of the longest substring with all unique characters, followed by a space, then the substring itself. If the string is empty, simply output 0.
Example:
3 abc## sample
0