#C14891. Longest Non-Repeating Substring

    ID: 44590 Type: Default 1000ms 256MiB

Longest Non-Repeating Substring

Longest Non-Repeating Substring

Given a string ( s ), your task is to find the length of its longest substring without repeating characters and also output all distinct longest substrings that satisfy this condition. For instance, for ( s = \text{'abcabcbb'} ), the longest substring length is ( 3 ) and the distinct longest substrings are ( {\text{'abc'}, \text{'bca'}, \text{'cab'}} ). If ( s ) is empty, the output should be ( 0 ) followed by an empty line.

inputFormat

The input consists of a single line containing the string ( s ). The string may include spaces and any visible characters. Input is provided via standard input (stdin).

outputFormat

Output two lines. The first line is an integer representing the length of the longest substring without repeating characters. The second line contains all distinct longest substrings sorted in lexicographical order and separated by a single space. If ( s ) is empty, output 0 on the first line and an empty second line.## sample

aaaaaaa
1

a

</p>