#C13642. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters
Given a string s
, find the longest substring which does not contain any repeating characters. You are required to output the length of this substring on the first line and the substring itself on the second line. If there is more than one such substring, output the one that appears first.
Example
Input: abcabcbb</p>Output: 3 abc
Note: The input will be provided via standard input (stdin) and the output should be written to standard output (stdout). Ensure that your solution works for edge cases such as an empty string.
inputFormat
The input consists of a single line containing the string s
.
outputFormat
Output two lines: the first line contains the length of the longest substring with all unique characters, and the second line contains the substring itself. If the input string is empty, only output 0
on the first line and leave the second line empty.
0