def get_longest_non_repeat_v1(string):
if string is None:<EOL><INDENT>return <NUM_LIT:0>, '<STR_LIT>'<EOL><DEDENT>sub_string = '<STR_LIT>'<EOL>dict = {}<EOL>max_length = <NUM_LIT:0><EOL>j = <NUM_LIT:0><EOL>for i in range(len(string)):<EOL><INDENT>if string[i] in dict:<EOL><INDENT>j = max(dict[string[i]], j)<EOL><DEDENT>dict[string[i]] = i + <NUM_LIT:1><EOL>if i - j + <NUM_LIT:1> > max_length:<EOL><INDENT>max_length = i - j + <NUM_LIT:1><EOL>sub_string = string[j: i + <NUM_LIT:1>]<EOL><DEDENT><DEDENT>return max_length, sub_string<EOL>
Find the length of the longest substring
without repeating characters.
Return max_len and the substring as a tuple