Solve this language-agnostic algorithmic problem using the programming language you feel most comfortable in.
Given a string s, return the length of its longest substring containing no repeated characters. A substring must contain consecutive characters. Implement length_of_longest_substring(s) and return an integer.
def length_of_longest_substring(s):