#include <bits/stdc++.h>
using namespace std;
static char s[500000];
static long long m1[26], m2[26];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  long long n = strlen(s), m = 0, a, b, r, c;
  for (long long i = 0; i < n; ++i) {
    m1[s[i] - 'a']++;
  }
  for (long long i = 0; i < 26; ++i)
    if (m1[i]) ++m;
  memset(m1, 0, sizeof(m1));
  cout << m << endl;
  for (long long i = 1; i <= m; ++i) {
    memset(m1, 0, sizeof(m1));
    a = -1;
    b = 0;
    while (a < n && b < i) {
      ++a;
      m1[s[a] - 'a']++;
      if (m1[s[a] - 'a'] == 1) ++b;
    }
    m2[i] = n - a;
    for (long long j = 0; a < n; ++j) {
      if (m1[s[j] - 'a'] == 1) --b;
      m1[s[j] - 'a']--;
      while (a < n && b < i) {
        ++a;
        m1[s[a] - 'a']++;
        if (m1[s[a] - 'a'] == 1) ++b;
      }
      m2[i] += n - a;
    }
  }
  for (long long i = 1; i < m; ++i) cout << m2[i] - m2[i + 1] << endl;
  cout << m2[m] << endl;
  return 0;
}
