Given a string, find the length of the longest substring without repeating characters。
public static int lengthOfLongestSubstring(String s) {
int result=0;
for(int i=0;i<s.length();i++){
int count=0;
HashMap<Character,Integer> map=new HashMap<>();
for(int j=i;j<s.length();j++){
if(!map.containsKey(s.charAt(j))){
map.put(s.charAt(j),1);
count++;
}else{
break;
}
}
if(count>=result){
result=count;
}
}
return result;
};