#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
char str[N];
int n, cnt[27];
long long ans[27], mx;
long long get(int len) {
  int cur = 0;
  long long ret = 0;
  for (int i = 0, j = -1; i < n; ++i) {
    while (cur < len and j + 1 < n)
      if (cnt[str[++j] - 'a']++ == 0) cur++;
    if (cur == len) ret += n - j;
    if (--cnt[str[i] - 'a'] == 0) cur--;
  }
  return ret;
}
int main() {
  n = strlen(gets(str));
  for (int i = 26; i >= 1; --i) {
    ans[i] = get(i);
    if (ans[i] and !mx) mx = i;
  }
  cout << mx << endl;
  for (int i = 1; i <= mx; ++i) cout << ans[i] - ans[i + 1] << endl;
  return 0;
}
