#include <bits/stdc++.h>
using namespace std;
const int MAX = 3e5 + 9;
string s;
int a[255], d, n, b[MAX];
int main() {
  cin >> s, n = s.size();
  for (auto i : s) a[i] = 1;
  for (int i = 0; i < 255; i++) d += a[i];
  cout << d << '\n';
  for (int i = 1; i <= d; i++) {
    memset(a, 0, sizeof a);
    int p1 = 0, p2 = 0, dd = 0;
    long long ans = 0;
    while (p1 < n) {
      while (p2 < n)
        if (a[s[p2]] || (a[s[p2]] == 0 && dd < i))
          a[s[p2]]++, dd += (a[s[p2]] == 1), p2++;
        else
          break;
      if (dd == i) ans += (p2 - p1) - b[p1], b[p1] = p2 - p1;
      a[s[p1]]--, dd -= (!a[s[p1]]), p1++;
    }
    cout << ans << '\n';
  }
}
