Write a function to identify the longest substring without repeating characters.
Implement length_of_longest_substring(s), returning the length of the longest contiguous substring in string s that contains no repeated characters. Return 0 for an empty string. The expected solution should run in linear time.
sdef length_of_longest_substring(s):