#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
string str;
int n;
long long cnt, ans[27];
int nxt[26][300500];
bool used[26];
int main() {
  cin >> str;
  n = str.size();
  for (int i = 0; i < 26; ++i) nxt[i][n] = 10000000;
  for (int i = n - 1; i >= 0; --i) {
    for (int j = 0; j < 26; ++j) nxt[j][i] = nxt[j][i + 1];
    nxt[str[i] - 'a'][i] = i;
  }
  for (int i = 0; i < n; ++i) {
    memset(used, 0, sizeof used);
    used[str[i] - 'a'] = true;
    int prev = i;
    for (int j = 1; j <= 26; ++j) {
      int mn = 100000000, id = -1;
      for (int k = 0; k < 26; ++k)
        if (!used[k] && nxt[k][prev] < mn) mn = nxt[k][prev], id = k;
      if (mn < n) {
        ans[j] += mn - prev, prev = mn;
        used[id] = true;
      } else {
        ans[j] += n - prev;
        break;
      }
    }
  }
  for (cnt = 26; cnt > 0; --cnt)
    if (ans[cnt] != 0) break;
  printf("%I64d\n", cnt);
  for (int i = 1; i <= cnt; ++i) printf("%I64d\n", ans[i]);
  return 0;
}
