#include <bits/stdc++.h>
using namespace std;
int n;
int cnt[30];
char s[300005];
int add(int x, int val) {
  int ans = 0;
  if (cnt[x] == 0 && val == 1) ans = 1;
  if (cnt[x] == 1 && val == -1) ans = -1;
  cnt[x] += val;
  return ans;
}
int main() {
  int i, mx, x, l, now;
  long long ans, last;
  scanf(" %s", s);
  n = strlen(s);
  for (i = 0; i < n; i++) cnt[s[i] - 'a'] = 1;
  mx = 0;
  for (i = 0; i < 26; i++) mx += cnt[i];
  printf("%d\n", mx);
  last = 0;
  for (x = 1; x <= mx; x++) {
    ans = 0;
    memset(cnt, 0, sizeof(cnt));
    l = 0;
    now = 0;
    for (i = 0; i < n; i++) {
      now += add(s[i] - 'a', 1);
      while (now > x) {
        now += add(s[l] - 'a', -1);
        l++;
      }
      ans += (long long)i - l + 1;
    }
    printf("%I64d\n", ans - last);
    last = ans;
  }
}
