解答:python3
class Solution:
def lengthOfLongestSubstring(self, str):
temp = ''
length = 0
for i in str:
if i not in temp:
temp += i
length = max(length, len(temp))
else:
temp += i
temp = temp[temp.index(i) + 1:]
return length