#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
char str[N];
long long ans[30];
long long cnt[26];
long long gao(int l) {
  long long ans = 0;
  memset(cnt, 0, sizeof(cnt));
  int n = strlen(str), cur = 0;
  for (int i = 0, j = 0; i < n; i++) {
    while (cur < l && j < n) {
      if (cnt[str[j] - 'a'] == 0) cur++;
      cnt[str[j++] - 'a']++;
    }
    if (cur == l) {
      ans += n - j + 1;
    }
    if ((--cnt[str[i] - 'a']) == 0) cur--;
  }
  return ans;
}
int main() {
  int ret = 26;
  cin >> str;
  for (int i = 1; i <= 26; i++) {
    ans[i] = gao(i);
    if (ans[i] == 0) {
      ret = i - 1;
      break;
    }
  }
  cout << ret << endl;
  for (int i = 1; i <= ret; i++) cout << ans[i] - ans[i + 1] << endl;
  return 0;
}
