#include <bits/stdc++.h>
using namespace std;
const int K = 26;
int first[K];
long long ans[K + 1];
int main() {
  for (int i = 0; i < K; i++) first[i] = -1;
  string s;
  cin >> s;
  vector<int> now;
  for (int i = 0; i < s.size(); i++) {
    int c = s[i] - 'a';
    vector<int> tmp(1, i);
    for (int j = 0; j < now.size(); j++)
      if (first[c] != now[j]) tmp.push_back(now[j]);
    sort(tmp.begin(), tmp.end());
    now = tmp;
    first[c] = i;
    for (int j = tmp.size() - 1; j >= 0; j--)
      ans[tmp.size() - j] += tmp[j] - (j ? tmp[j - 1] : -1);
  }
  int sz = K;
  for (int i = 1; i <= K; i++)
    if (!ans[i]) {
      sz = i - 1;
      break;
    }
  cout << sz << endl;
  for (int i = 1; i <= sz; i++) cout << ans[i] << endl;
  return 0;
}
