func lengthOfLongestSubstring(s string)int{ var length = 0 var max = 0 var start = 0//慢指针 var end = 0//快指针 for end<len(s){ tmpChar:=s[end] for i:=start;i<end;i++{ if tmpChar==s[i]{ start = i+1 length = end-start break } } length++ end++ max = int(math.Max(float64(length), float64(max))) } return max }