#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
char s[N];
int n;
int occ[N][26];
long long ans[N];
int main() {
  memset(occ, -1, sizeof occ);
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) occ[i][(int)s[i] - 'a'] = i;
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      if (occ[i][j] == -1) occ[i][j] = occ[i + 1][j];
    }
  }
  int mx = 0;
  for (int i = 0; i < n; i++) {
    int p = i;
    vector<int> q;
    for (int c = 0; c < 26; c++) {
      int it = occ[i][c];
      if (it == -1) continue;
      q.emplace_back(it);
    }
    sort(q.begin(), q.end());
    int cnt = 0;
    for (int nx : q) {
      ans[cnt] += nx - p;
      p = nx;
      cnt++;
    }
    ans[cnt] += n - p;
    mx = max(mx, cnt);
  }
  printf("%d\n", mx);
  for (int i = 1; i <= mx; i++) printf("%lld\n", ans[i]);
}
