#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
long long cnt[27];
int last[26];
int g[300000][26];
string s;
int main() {
  cin >> s;
  n = ((int)(s).size());
  for (int i = 0; i < 26; i++) last[i] = n;
  for (int i = n - 1; i >= 0; i--) {
    last[s[i] - 'a'] = i;
    for (int j = 0; j < 26; j++) g[i][j] = last[j];
  }
  for (int i = 0; i < n; i++) {
    int mask = 1 << (s[i] - 'a'), cur = 1;
    int j = i;
    while (j < n) {
      int k = n, ch = 0;
      for (int t = 0; t < 26; t++)
        if (((mask >> t) & 1) == 0 && g[j][t] < k) {
          k = g[j][t];
          ch = t;
        }
      cnt[cur] += k - j;
      cur++;
      mask |= 1 << ch;
      j = k;
    }
  }
  int ans = 0;
  while (ans < 26 && cnt[ans + 1]) ans++;
  printf("%d\n", ans);
  for (int i = 1; i <= 26; i++)
    if (cnt[i] != 0) printf("%I64d\n", cnt[i]);
  return 0;
}
