#include <bits/stdc++.h>
using namespace std;
int A[255], StrDiv;
long long Am[30];
string S;
int main() {
  cin >> S;
  for (int div = 1; div <= 'z' - 'a' + 1; div++) {
    int a = 0, b = 0, d = 0;
    long long mult = 1;
    for (int i = 'a'; i <= 'z'; i++) A[i] = 0;
    while (b < S.length()) {
      A[S[b]]++;
      if (A[S[b]] == 1) d++;
      b++;
      while (d > div) {
        mult = 1;
        A[S[a]]--;
        if (A[S[a]] == 0) d--;
        a++;
      }
      while (d == div && A[S[a]] - 1 > 0) {
        A[S[a]]--;
        a++;
        mult++;
      }
      if (d == div) Am[div] += mult;
    }
    if (Am[div]) StrDiv = div;
  }
  cout << StrDiv << "\n";
  for (int d = 1; d <= StrDiv; d++) cout << Am[d] << "\n";
}
