String diversity is the number of symbols that occur in the string at least once. Diversity of *s* will be denoted by *d*(*s*). For example , *d*("aaa")=1, *d*("abacaba")=3.

Given a string *s*, consisting of lowercase Latin letters. Consider all its substrings. Obviously, any substring diversity is a number from 1 to *d*(*s*). Find statistics about substrings diversity: for each *k* from 1 to *d*(*s*), find how many substrings of *s* has a diversity of exactly *k*.
The input consists of a single line containing *s*. It contains only lowercase Latin letters, the length of *s* is from 1 to 3·10<sup class="upper-index">5</sup>.
/* --- Author: Vladimir Smykalov, [email protected] --- */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <ctime>
#include <cassert>
 
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define forit(it,v) for(typeof((v).begin()) it = v.begin() ; it != (v).end() ; ++it)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),a.end()
 
using namespace std;
 
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
 
const int inf = (int)1e9;
const ld eps = 1e-9;
 
/* --- main part --- */
 
#define TASK "a"
 
const int maxn = (int)3e5 + 10;
const int L = 26;
 
char s[maxn];
int next[maxn][L + 1];
ll res[L + 1];
 
 
int main()
{
    #ifdef home
        assert(freopen(TASK".in", "r", stdin));
        assert(freopen(TASK".out", "w", stdout));
    #endif
    scanf("%s", s);
    int n = strlen(s);
    forn(i, L)
    {
        next[n][i] = n;
        for (int j = n - 1; j >= 0; --j)
        {
            if (s[j] == 'a' + i) next[j][i] = j;
            else next[j][i] = next[j + 1][i];
        }
    }
    forn(i, n)
    {
        next[i][L] = n;
        sort(next[i], next[i] + L);
        forn(j, L)
        {
            res[j + 1] += next[i][j + 1] - next[i][j];
        }
    }
    int ds = 0;
    forn(i, L) if (next[0][i] != n) ds += 1;
    printf("%d\n", ds);
    forn(i, ds) printf("%I64d\n", res[i + 1]); 
    #ifdef home
        eprintf("Time: %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif
    return 0;
}
 