#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, char> > v;
  long long int p[30] = {0};
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); ++i) {
    bool flag = false;
    for (int j = 0; j < v.size(); ++j) {
      if (v[j].second == s[i]) {
        v[j].first = i;
        flag = true;
        break;
      }
    }
    if (!flag) {
      v.push_back(make_pair(i, s[i]));
    }
    sort(v.begin(), v.end());
    int cnt = 1, last = i;
    for (int j = v.size() - 2; j >= 0; --j) {
      p[cnt++] += (last - v[j].first);
      last = v[j].first;
    }
    p[cnt++] += v[0].first + 1;
  }
  int cnt = 0;
  for (int i = 0; i < 30; ++i) {
    if (p[i]) {
      ++cnt;
    }
  }
  cout << cnt << endl;
  for (int i = 1; i <= cnt; ++i) {
    cout << p[i] << endl;
  }
  return 0;
}
