def longest_non_repeat_v1(string):
if string is None:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>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>max_length = max(max_length, i - j + <NUM_LIT:1>)<EOL><DEDENT>return max_length<EOL>
Find the length of the longest substring
without repeating characters.