#include <bits/stdc++.h>
using namespace std;
struct _ {
  ios_base::Init i;
  _() {
    cin.sync_with_stdio(0);
    cin.tie(0);
  }
} _;
const int N = 3e5 + 7, M = 26;
long long pref[N][M + 1];
int cu[N];
long long ans[M + 1];
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int prev[M];
  for (int i = 0; i < M; ++i) prev[i] = -1;
  for (int i = 0; i < N; ++i) cu[i] = 0;
  for (int i = 0; i < n; ++i) {
    int last = prev[s[i] - 'a'];
    prev[s[i] - 'a'] = i;
    if (last >= 0)
      for (int j = 1; j <= M; ++j) ans[j] += pref[last][j];
    long long ct1[M + 1], ct2[M + 1];
    for (int j = 1; j <= M; ++j) ct1[j] = ct2[j] = 0;
    for (int j = last + 1; j < i; ++j) {
      ++ct1[cu[j]];
      ++cu[j];
      ++ct2[cu[j]];
      ++ans[cu[j]];
      for (int k = 1; k <= M; ++k) pref[j][k] += ct2[k] - ct1[k];
    }
    if (i > 0)
      for (int k = 1; k <= M; ++k) pref[i][k] = pref[i - 1][k];
    ++pref[i][1];
    ++ans[1];
    cu[i] = 1;
  }
  set<char> ss;
  for (int i = 0; i < n; ++i) ss.insert(s[i]);
  int sz = ss.size();
  cout << sz << '\n';
  for (int i = 1; i <= sz; ++i) cout << ans[i] << '\n';
  return 0;
}
