**输出:** "abcabcbb"
**输入:** 3
**解释:** 因为无反复字符的最长子串是 "abc",所以其长度为 3。
func lengthOfLongestSubstring(s string) int {
m := map[byte]int{}
n := len(s)
rk, ans := -1, 0
var j int
j = 0
ok := false
for i := 0; i < n&&rk+1 <n; i++ {
if i != 0 && rk + 1<n {
i = m[s[rk+1]]+1
}
for ;rk + 1 < n;rk++{
j,ok =m[s[rk+1]]
if ok&&j>=i{break}
m[s[rk+1]] =rk + 1
}
if !(ans>(rk - i+1)){ans = rk-i+1}
}
return ans
}