#include <bits/stdc++.h>
const int maxn = 310000;
long long f[maxn + 1];
int K, n;
char s[maxn + 1];
int ge[26];
void init() {
  int i;
  bool you[26];
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (i = 0; i < 26; ++i) you[i] = false;
  for (i = 1; i <= n; ++i) you[s[i] - 'a'] = true;
  K = 0;
  for (i = 0; i < 26; ++i)
    if (you[i]) ++K;
}
void work() {
  int i, j, yao, diff;
  int ge[26];
  for (yao = 1; yao <= K; ++yao) {
    for (j = 0; j < 26; ++j) ge[j] = 0;
    j = 1;
    diff = 0;
    for (i = 1; i <= n; ++i) {
      if (i > 1) {
        --ge[s[i - 1] - 'a'];
        if (ge[s[i - 1] - 'a'] == 0) --diff;
      }
      while (j <= n) {
        ++ge[s[j] - 'a'];
        if (ge[s[j] - 'a'] == 1) ++diff;
        if (diff > yao) {
          --ge[s[j] - 'a'];
          --diff;
          break;
        }
        ++j;
      }
      f[yao] += j - i;
    }
  }
  for (i = K; i >= 2; --i) f[i] -= f[i - 1];
}
void output() {
  int i;
  printf("%d\n", K);
  for (i = 1; i <= K; ++i) printf("%I64d\n", f[i]);
}
int main() {
  init();
  work();
  output();
  return 0;
}
