#include <bits/stdc++.h>
using namespace std;
char s[300001];
long long ts[27] = {};
pair<char, int> lasts[27];
int main() {
  gets(s);
  for (int i = 0; i < 27; i++) {
    lasts[i] = make_pair('a' + i, -1);
  }
  class _Pred {
   public:
    bool operator()(const pair<char, int>& a, const pair<char, int>& b) {
      return a.second > b.second;
    }
  } pred;
  int p = 0;
  while (s[p] != '\0') {
    sort(lasts, lasts + 26, pred);
    int last_p = p;
    int d = 0;
    for (int i = 0; i <= 26 && last_p != -1; i++) {
      if (lasts[i].first == s[p]) {
        continue;
      }
      ts[d] += last_p - lasts[i].second;
      last_p = lasts[i].second;
      d++;
    }
    for (int i = 0; i < 26; i++) {
      if (lasts[i].first == s[p]) {
        lasts[i].second = p;
      }
    }
    p++;
  }
  int d = 27;
  while (ts[--d] == 0)
    ;
  printf("%d\n", d + 1);
  for (int i = 0; i <= d; i++) {
    printf("%I64d\n", ts[i]);
  }
  return 0;
}
