int left=0,right=0,max=Integer.MIN_VALUE; Set<Character> set=newHashSet<>(); set.add(s.charAt(0));
while (left<s.length()){ //扩展窗口 while (right<s.length()-1&&!set.contains(s.charAt(right+1))){ right++; set.add(s.charAt(right)); } max=Math.max(max,right-left+1);