import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param s string字符串 
     * @return int整型
     */
    public int lengthOfLongestContinuousTasks (String s) {
        HashSet<Character> set=new HashSet<>();
        int len=s.length();
        char ch;
        int max=0;
        for(int i=0,j=0;j<len;j++){
            ch=s.charAt(j);
            while(set.contains(ch)){    //当set包含右指针字符
                set.remove(s.charAt(i));    //set删除左指针的字符,并移动左指针
                i++;
            }
            set.add(ch);
            if(set.size()>max)max=set.size();
        }
        return max;
    }
}