#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000;
const int ALPH = 26;
const int PANDA = 3 * 100000 + 1;
char buf[PANDA], cbuf[PANDA];
long long cnt[ALPH + 1];
int let[ALPH];
int len;
int sz;
void cleverAdd(char c, int val) {
  c -= 'a';
  if (let[c] == 0) {
    ++sz;
  }
  let[c] += val;
  if (let[c] == 0) {
    --sz;
  }
}
int calcDiff() {
  memcpy(cbuf, buf, len * sizeof(char));
  sort(cbuf, cbuf + len);
  int ret = 1;
  for (int i = 1; i < len; ++i)
    if (cbuf[i] != cbuf[i - 1]) {
      ++ret;
    }
  return ret;
}
int main() {
  scanf("%s", buf);
  len = strlen(buf);
  int D = calcDiff();
  for (int d = 1; d <= D; ++d) {
    int lf = 0, rg = 0;
    sz = 0;
    memset(let, 0, ALPH * sizeof(int));
    while (lf < len) {
      rg = max(lf, rg);
      while (rg < len && sz < d) {
        cleverAdd(buf[rg], 1);
        ++rg;
      }
      if (sz == d) {
        cnt[d - 1] += len - rg + 1;
      } else {
        break;
      }
      cleverAdd(buf[lf], -1);
      ++lf;
    }
  }
  printf("%d\n", D);
  for (int i = 0; i < D; ++i) {
    printf("%I64d\n", cnt[i] - cnt[i + 1]);
  }
  return 0;
}
