#include <bits/stdc++.h>
using namespace std;
long long n, ans;
char ch[3000005];
long long flag[35], cnt;
long long flag2[35];
int main() {
  long long i, j, k, l, tot, tot2;
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  for (i = 1; i <= n; i++) flag[ch[i] - 96]++;
  for (i = 1; i <= 26; i++)
    if (flag[i]) cnt++;
  cout << cnt << endl;
  for (i = 1; i <= cnt; i++) {
    memset(flag, 0, sizeof(flag));
    memset(flag2, 0, sizeof(flag2));
    tot = 0;
    tot2 = 0;
    ans = 0;
    k = 1;
    l = 1;
    for (j = 1; j <= n; j++) {
      while (k <= n && tot < i)
        tot += (flag[ch[k] - 96] == 0), flag[ch[k++] - 96]++;
      while (l <= n && tot2 + (flag2[ch[l] - 96] == 0) <= i)
        tot2 += (flag2[ch[l] - 96] == 0), flag2[ch[l++] - 96]++;
      if (tot == i) ans += l - k + 1;
      flag[ch[j] - 96]--;
      tot -= (flag[ch[j] - 96] == 0);
      flag2[ch[j] - 96]--;
      tot2 -= (flag2[ch[j] - 96] == 0);
    }
    cout << ans << endl;
  }
  return 0;
}
