I have a working solution I think, but I get a time limited exceeded. Can anyone tell me what I am missing?

```
def lengthOfLongestSubstring(self, s):
if len(s) <= 0:
return 0
max_count = 1
letters = {}
start = 0
for i in range(len(s)):
if s[i] in letters:
if letters[s[i]] >= start:
temp_length = i - start
max_count = temp_length if temp_length > max_count else max_count
start = letters[s[i]] + 1
letters[s[i]] = i
return max_count
```