#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 10;
const long long mod = 1e9 + 7;
int n, m;
char ss[maxn];
void init(long long a[], int b) {
  for (int i = 0; i <= b; i++) {
    a[i] = 0;
  }
}
map<char, int> mp, cnt, cnt1;
long long solve(int x) {
  long long res = 0;
  int r = 0, r1 = 0, sm = 0, sm1 = 0;
  cnt.clear(), cnt1.clear();
  for (int i = 1; i <= n; i++) {
    while (sm < x && r <= n) {
      r++;
      if (++cnt[ss[r]] == 1) sm++;
    }
    while (sm1 <= x && r1 <= n) {
      r1++;
      if (++cnt1[ss[r1]] == 1) sm1++;
    }
    if (sm == x && sm1 >= x) res += r1 - r;
    if (--cnt[ss[i]] == 0) sm--;
    if (--cnt1[ss[i]] == 0) sm1--;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> ss + 1;
  n = strlen(ss + 1);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (!mp[ss[i]]) {
      cnt++;
    }
    mp[ss[i]]++;
  }
  cout << cnt << endl;
  for (int i = 1; i <= cnt; i++) {
    cout << solve(i) << endl;
  }
  return 0;
}
