#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline int popcount(T t) {
  if (std::numeric_limits<T>::digits <=
      std::numeric_limits<unsigned int>::digits) {
    return __builtin_popcount(t);
  } else {
    return __builtin_popcountll(t);
  }
}
const long double EPS = 1e-8;
const long double PI = acosl(0.0) * 2;
void solve() {
  string s;
  getline(cin, s);
  int n = s.length();
  vector<vector<int> > next(26, vector<int>(n + 1, n));
  for (int i = 0; i < int(26); ++i) {
    char c = 'a' + i;
    for (int j = n - 1; j >= 0; --j) {
      if (s[j] == c) {
        next[i][j] = j;
      } else {
        next[i][j] = next[i][j + 1];
      }
    }
  }
  vector<long long> stat(27);
  for (int k = 0; k < int(n); ++k) {
    int cnt = 0;
    vector<int> used(26);
    int i = k;
    while (i < n) {
      used[s[i] - 'a'] = 1;
      ++cnt;
      int j = n;
      for (int l = 0; l < int(26); ++l) {
        if (used[l]) continue;
        j = min(j, next[l][i]);
      }
      stat[cnt] += j - i;
      i = j;
    }
  }
  int mx = 26;
  while (stat[mx] == 0) --mx;
  cout << mx << endl;
  for (int i = 1; i <= int(mx); ++i) {
    cout << stat[i] << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
