public P386C() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        N = s.length();
        
        for (int i = 0; i < 26; i++) {
            letterCount[i] = new BIT(N);
        }
        
        dp = new long[N][];
        prev = new int[N];
        
        int[] last = new int[26];
        for (int i = 0; i < 26; i++) {
            last[i] = -1;
        }
        
        for (int i = 0; i < N; i++) {
            int c = s.charAt(i) - 'a';
            prev[i] = last[c];
            last[c] = i;
            letterCount[c].set(i+1, 1);
        }
        
        divMax = 0;
        for (int i = 0; i < 26; i++) {
            if (last[i] >= 0) divMax++;
        }
        
        System.out.println(divMax);
        
        for (int i = 0; i < N; i++) {
            dp[i] = new long[divMax+1];
            dp[i][0] = 1;
        }
        dp[0][1] = 1;
        
        for (int i = 1; i < N; i++) {
            process(i);
        }
        
        for (int d = 1; d <= divMax; d++) {
            long result = 0;
            for (int i = 0; i < N; i++) {
                result += dp[i][d];
            }
            System.out.println(result);
        }
    }