def longest_substring_length(string):
    """Returns length of the longest substring without repetition of characters """
    dct = {}
    result = 0
    start = 0
    counter = 0
    for index, val in enumerate(string):
        if val not in dct:
            dct[val] = index
            counter += 1
        else:
            if dct[val] >= start:
                start = dct[val] + 1
                counter = index - dct[val] -1
            counter += 1
            dct[val] = index
        result = max(result, counter)
    return result