import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int[] v = new int[s.length()];
        for(int i = 0; i < s.length(); ++i){
            Set<Character> st = new HashSet<>();//利用集合来判断有无重复
            for(int j = i; j < s.length(); ++j){
                if(!st.contains(s.charAt(j))) st.add(s.charAt(j));
                else break;
            }
            v[i] = st.size();
        }
        Arrays.sort(v);
        System.out.println(v[v.length - 1]);
    }
}