#include <bits/stdc++.h>
using namespace std;
const int maxn = 300005;
string s;
long long ans[26];
int n, dp[26][maxn], cnt[27];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  n = s.length();
  for (int d = 1; d < 27; ++d) {
    fill(cnt, cnt + 26, 0);
    int cur = 0;
    for (int i = 0, j = 0; i < n; ++i) {
      if (i > 0) {
        if (cnt[s[i - 1] - 'a'] == 1) --cur;
        --cnt[s[i - 1] - 'a'];
      }
      for (; j < n && cur < d; ++j) {
        if (cnt[s[j] - 'a'] == 0) ++cur;
        ++cnt[s[j] - 'a'];
      }
      dp[d - 1][i] = cur == d ? j : (n + 1);
    }
  }
  int res = 0;
  while (res < 26 && dp[res][0] != n + 1) ++res;
  for (int d = 0; d < res; ++d)
    for (int i = 0; i < n; ++i)
      if (d < res - 1)
        ans[d] += dp[d + 1][i] - dp[d][i];
      else
        ans[d] += n + 1 - dp[d][i];
  cout << res << '\n';
  for (int i = 0; i < res; ++i) cout << ans[i] << '\n';
  return 0;
}
