#include <bits/stdc++.h>
using namespace std;
string s;
int pos[200], tot;
long long ans[200], p[200];
int main() {
  cin >> s;
  s = " " + s;
  for (int i = 1; i < s.length(); i++) {
    pos[s[i]] = i;
    tot = 1;
    for (int j = 'a'; j <= 'z'; j++)
      if (pos[j]) p[tot++] = pos[j];
    sort(p, p + tot);
    for (int j = 1; j < tot; j++) ans[tot - j] += p[j] - p[j - 1];
  }
  for (int i = 26; i; i--)
    if (ans[i]) {
      cout << i << endl;
      for (int j = 1; j <= i; j++) cout << ans[j] << endl;
      return 0;
    }
}
