#include <bits/stdc++.h>
using namespace std;
void add(vector<char>& vc, vector<int>& vi, char c, int i) {
  int index = find(vc.begin(), vc.end(), c) - vc.begin();
  if (index != vc.size()) {
    vc.erase(vc.begin() + index);
    vi.erase(vi.begin() + index);
  }
  vc.push_back(c);
  vi.push_back(i);
}
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  vector<char> characters;
  vector<int> indexes;
  add(characters, indexes, '#', s.size());
  vector<long long> ans(30, 0);
  for (int i = s.size() - 1; i >= 0; --i) {
    add(characters, indexes, s[i], i);
    for (int j = indexes.size() - 1; j > 0; --j) {
      ans[indexes.size() - j] += indexes[j - 1] - indexes[j];
    }
  }
  cout << indexes.size() - 1 << endl;
  for (int i = 1; ans[i] != 0; ++i) {
    cout << ans[i] << endl;
  }
  return 0;
}
