#include <bits/stdc++.h>
using namespace std;
string ts = "abcdefghijklmnopqrstuvwxyz";
int main() {
  string s;
  cin >> s;
  int n = (int)s.size();
  int p[26];
  for (int i = 0; i < 26; ++i) {
    p[i] = (int)s.find(ts.substr(i, 1));
  }
  long long ans[27] = {};
  for (int i = 0; i < n; ++i) {
    int tmp[27];
    int k = 0;
    for (int c = 0; c < 26; ++c) {
      if (p[c] >= i) {
        tmp[k++] = p[c];
      }
    }
    tmp[k++] = n;
    sort(tmp, tmp + k);
    for (int c = 1; c < k; ++c) {
      ans[c] += tmp[c] - tmp[c - 1];
    }
    p[s[i] - 'a'] = (int)s.find(s.substr(i, 1), i + 1);
  }
  int cnt = 1;
  while (cnt < 26 && ans[cnt + 1] > 0) {
    ++cnt;
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; ++i) {
    cout << ans[i] << endl;
  }
}
