class Solution {
public:
int lengthOfLongestSubstring(string s) {
unordered_map<char, int> hashmap;
int count = 0;
int max = 0;
int start = 0;
int end = 0;
while(start < s.length())
{
hashmap[s[start]]++;
while(hashmap[s[start]] > 1)
{
hashmap[s[end]]--;
end++;
}
count = start - end + 1;
if(count > max)
max = count;
start++;
}
return max;
}
};