#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long min(long long a, long long b) { return (a > b) ? b : a; }
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  vector<long long> pos(26, -1);
  unordered_map<long long, long long> ans;
  long long ds = 0;
  for (long long i = 0; i < s.length(); i++) {
    if (pos[s[i] - 'a'] == -1) ds++;
    pos[s[i] - 'a'] = i;
    vector<long long> p;
    for (long long j = 0; j < 26; j++) {
      if (pos[j] != -1) {
        p.push_back(pos[j]);
      }
    }
    sort(p.begin(), p.end(), greater<long long>());
    if (p.back() != -1) p.push_back(-1);
    long long cnt = 1;
    for (long long j = 0; j < p.size() - 1; j++) {
      ans[cnt++] += p[j] - p[j + 1];
    }
  }
  cout << ds << endl;
  for (long long i = 1; i <= ds; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}
