#include <bits/stdc++.h>
using namespace std;
const int N = 333333;
string str;
int n;
struct SegmentTree {
  int mask[N << 2];
  void build(int p, int l, int r) {
    if (l == r) {
      mask[p] = 1 << (str[l] - 'a');
      return;
    }
    int mid = l + r >> 1;
    build(p << 1, l, mid);
    build(p << 1 | 1, mid + 1, r);
    mask[p] = mask[p << 1] | mask[p << 1 | 1];
  }
  int query(int p, int l, int r, int L, int R, int m) {
    if (L > R) return n;
    if (L <= l && r <= R && (m & mask[p]) == 0) return n;
    if (l == r) return l;
    int mid = l + r >> 1;
    int res = n;
    if (L <= mid) {
      res = min(res, query(p << 1, l, mid, L, R, m));
    }
    if (res < n) return res;
    if (mid < R) {
      res = min(res, query(p << 1 | 1, mid + 1, r, L, R, m));
    }
    return res;
  }
} st;
long long counter[30];
int main() {
  cin >> str;
  n = str.length();
  int mask = 0;
  for (int i = 0; i < str.length(); i++) {
    mask |= 1 << (str[i] - 'a');
  }
  int cnt = 0;
  for (int i = 0; i < 26; i++) {
    if (mask >> i & 1) cnt++;
  }
  cout << cnt << endl;
  st.build(1, 0, n - 1);
  memset(counter, 0, sizeof(counter));
  for (int i = 0; i < str.length(); i++) {
    int pre, now = i;
    int m = (1 << 26) - 1;
    int t = 0;
    while (now < n) {
      m ^= (1 << (str[now] - 'a'));
      pre = now, now = st.query(1, 0, n - 1, now + 1, n - 1, m);
      counter[++t] += now - pre;
    }
  }
  for (int i = 1; i <= cnt; i++) cout << counter[i] << endl;
  return 0;
}
