#include <bits/stdc++.h>
using namespace std;
string s;
int p[26];
long long t[27];
struct cmp {
  bool operator()(char l, char r) { return p[l - 'a'] < p[r - 'a']; }
};
set<char, cmp> a;
int main() {
  memset(p, -1, sizeof(p));
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    a.erase(s[i]);
    p[s[i] - 'a'] = i;
    a.insert(s[i]);
    int l = 0, d = a.size();
    for (set<char>::iterator it = a.begin(); it != a.end(); it++) {
      t[d--] += p[*it - 'a'] - l + 1;
      l = p[*it - 'a'] + 1;
    }
  }
  cout << a.size() << '\n';
  for (int i = 1; i <= a.size(); i++) cout << t[i] << '\n';
}
