Solve a problem that requires finding the longest substring without repeating characters.
Implement length_of_longest_substring(s) to return the length of the longest contiguous substring in s that contains no repeated characters. The input is a string, and the output is an integer; treat characters as distinct according to Python string equality.
def length_of_longest_substring(s):