#include <bits/stdc++.h>
using namespace std;
int mread() {
  int ret = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  do {
    ret = ret * 10 + c - '0';
    c = getchar();
  } while ('0' <= c && c <= '9');
  return ret * f;
}
char s[300100];
int len, ds;
int cnt[30];
int add(int x) {
  if (!cnt[x]) return 1;
  return 0;
}
int del(int x) {
  if (cnt[x] == 1) return 1;
  return 0;
}
long long tot[30];
int main() {
  int l, r;
  long long now;
  scanf("%s", s + 1);
  len = strlen(s + 1);
  for (int i = 1; i <= len; i++) {
    ds = ds + add(s[i] - 'a');
    cnt[s[i] - 'a']++;
  }
  for (int i = ds; i >= 1; i--) {
    memset(cnt, 0, sizeof(cnt));
    l = 1, r = 0;
    now = 0;
    while (r + 1 <= len && now + add(s[r + 1] - 'a') <= i) {
      now += add(s[r + 1] - 'a');
      cnt[s[r + 1] - 'a']++;
      r++;
      if (now == i) break;
    }
    for (int j = r; j <= len; j++) {
      while (l < j && now - del(s[l] - 'a') >= i) {
        now -= del(s[l] - 'a');
        cnt[s[l] - 'a']--;
        l++;
      }
      tot[i] += l;
      if (j != len) {
        now += add(s[j + 1] - 'a');
        cnt[s[j + 1] - 'a']++;
      }
    }
  }
  printf("%d\n", ds);
  for (int i = 1; i <= ds; i++) printf("%lld\n", tot[i] - tot[i + 1]);
  return 0;
}
