#include <bits/stdc++.h>
using namespace std;
const int maxn = 3 * 100000 + 10;
char op[maxn];
long long sum[maxn];
int p[26];
vector<int> q;
int main() {
  scanf("%s", op);
  int l = strlen(op);
  memset(p, -1, sizeof(p));
  for (int i = 0; i < l; i++) {
    int c = op[i] - 'a';
    p[c] = max(p[c], i);
    q.clear();
    for (int j = 0; j < 26; j++) {
      if (p[j] != -1) {
        q.push_back(p[j]);
      }
    }
    sort(q.begin(), q.end());
    int f = 1, j = q.size() - 2, now = i;
    for (; j >= 0; j--, f++) {
      int t = q[j];
      sum[f] += now - t;
      now = t;
    }
    sum[f] += now + 1;
  }
  int cn = 0;
  for (int i = 0; i < 26; i++) {
    if (p[i] != -1) cn++;
  }
  cout << cn << endl;
  for (int i = 1; i <= cn; i++) {
    cout << sum[i] << endl;
  }
  return 0;
}
