How would you find the length of the longest substring without repeating characters?
Implement length_of_longest_substring(s), which accepts a string and returns the maximum length of a contiguous substring containing no repeated characters. Use an efficient approach suitable for strings up to 50,000 characters.
def length_of_longest_substring(s):