#include <bits/stdc++.h>
using namespace std;
char str[300005];
vector<int> idx[27];
int main() {
  int x;
  scanf("%s", str);
  int n = strlen(str);
  for (int i = 0; i < (int)(n); i++) {
    idx[str[i] - 'a'].push_back(i);
  }
  long long int ans[27] = {0};
  int ansmax = 0;
  for (int i = 0; i < (int)(n); i++) {
    set<int> fir;
    for (int j = 0; j < (int)(26); j++) {
      vector<int>::iterator it = lower_bound(idx[j].begin(), idx[j].end(), i);
      if (it != idx[j].end()) fir.insert(*it);
    }
    int p = i;
    int c = 0;
    for (__typeof((fir).begin()) it = (fir).begin(); it != (fir).end(); ++it) {
      ans[c++] += *it - p;
      p = *it;
    }
    ans[c] += n - p;
    ansmax = max(ansmax, c);
  }
  cout << ansmax << endl;
  for (int i = 0; i < (int)(ansmax); i++) cout << ans[i + 1] << endl;
  return 0;
}
