# @param {String} s
# @return {Integer}
def length_of_longest_substring(s)
    index = 0
    temp_max = 0
    partial = ""
    
    return s.length if s.length <= 1
    
    while s.length > index
        if partial.include?(s[index])
            if temp_max < partial.length
                temp_max = partial.length
            end
            left = partial.index(s[index])
                
            partial = partial[left + 1, partial.length]
        end
        partial += s[index]
            
        index += 1
    end
    
    temp_max = partial.length if temp_max < partial.length
                
    return temp_max
end