python
\ndef lengthOfLongestSubstring(self, s: str) -> int:\n        maxLength = 0\n        dict = {}\n\n        i,j = 0,0\n        n = len(s)\n\n        while(j < n):
```\ndef lengthOfLongestSubstring(self, s: str) -> int:\n        maxLength = 0\n        dict = {}\n\n        i,j = 0,0\n        n = len(s)\n\n        while(j < n):\n            c = s[j]     \n            \n            dict[c] = 1 if not c in dict else dict[c] + 1\n            \n            \n            if dict[c] > 1:\n                while(dict[c] > 1):\n                    dict[s[i]] -= 1\n                    i += 1\n                    \n            maxLength = max(maxLength, j - i + 1)\n            j += 1\n\n        return maxLength\n```
[]