#C13111. Longest Unique Substring

    ID: 42614 Type: Default 1000ms 256MiB

Longest Unique Substring

Longest Unique Substring

Given a string \( s \), find the longest substring that contains all unique characters. You need to return the substring along with its starting index in \( s \). If there are multiple answers, output the one that occurs first. For an empty string, return an empty substring and index 0.

Mathematically, if \( s[i:j] \) is a valid substring with all distinct characters and no substring longer than \( s[i:j] \) exists, then the output should be \( (s[i:j], i) \).

inputFormat

The input consists of a single line containing the string \( s \) with \( 0 \le |s| \le 10^5 \).

outputFormat

Output the longest substring with all unique characters followed by its starting index in \( s \) separated by a space.

## sample
abrkaabcdefghijjxxx
abcdefghij 5