#include <bits/stdc++.h>
using namespace std;
int last[27], d;
long long de[27];
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++)
    if (!last[s[i] - 'a']) last[s[i] - 'a'] = i + 1, d++;
  cout << d << endl;
  memset(last, 0, sizeof(last));
  for (int i = 0; i < s.length(); i++) {
    last[s[i] - 'a'] = i + 1;
    vector<int> l;
    for (int j = 0; j <= 26; j++)
      if (last[j]) l.push_back(last[j] - 1);
    sort(l.begin(), l.end(), greater<int>());
    for (int j = 0; j < l.size() - 1; j++) de[j + 1] += l[j] - l[j + 1];
    de[l.size()] += l[l.size() - 1] + 1;
  }
  for (int i = 1; i <= d; i++) cout << de[i] << endl;
  return 0;
}
