#include <bits/stdc++.h>
using namespace std;
char s[300005];
int next_[300005][26];
int main() {
  scanf("%s", s);
  int n = (int)strlen(s);
  long long ans[27] = {n};
  long long tmp[27];
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      if (i == n - 1)
        next_[i][j] = n;
      else
        next_[i][j] = next_[i + 1][j];
    }
    next_[i][s[i] - 'a'] = i;
  }
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < 26; k++) tmp[k] = next_[i][k];
    tmp[26] = n;
    sort(tmp, tmp + 26);
    for (int p = 0; p < 26; p++) ans[p + 1] += tmp[p + 1] - tmp[p];
  }
  int cnt = 0;
  for (int i = 1; i <= 26; i++)
    if (ans[i]) cnt = i;
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; i++) printf("%I64d\n", ans[i]);
}
