#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 300000;
char s[MAX_N + 4];
int ps[26], qs[26];
long long ds[26 + 1];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; i++) {
    ps[s[i] - 'a'] = i + 1;
    memcpy(qs, ps, sizeof(ps));
    sort(qs, qs + 26);
    for (int i = 25, d = 1; i >= 0; i--, d++)
      ds[d] += (i > 0) ? qs[i] - qs[i - 1] : qs[i];
  }
  int maxd = 0;
  for (int d = 1; d <= 26; d++)
    if (ds[d] > 0) maxd = d;
  printf("%d\n", maxd);
  for (int i = 1; i <= maxd; i++) printf("%lld\n", ds[i]);
  return 0;
}
