#include <bits/stdc++.h>
using namespace std;
const int MAX = 400000 + 10;
int n;
char str[MAX];
int near[MAX];
long long ans[MAX];
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  int i;
  set<int> num;
  for ((i) = (1); (i) <= (n); ++(i)) {
    if (near[str[i] - 'a']) num.erase(near[str[i] - 'a']);
    num.insert(near[str[i] - 'a'] = i);
    set<int>::iterator it;
    int last = 0, res = num.size();
    for ((it) = (num.begin()); (it) != (num.end()); ++(it)) {
      ans[res] += *it - last;
      last = *it;
      res--;
    }
  }
  for ((i) = (1); (i) <= (n); ++(i))
    if (!ans[i]) break;
  printf("%d\n", i - 1);
  for ((i) = (1); (i) <= (n); ++(i)) {
    if (!ans[i]) break;
    cout << ans[i] << endl;
  }
  return 0;
}
