#include <bits/stdc++.h>
using namespace std;
int diversity(string s) {
  set<char> letters;
  for (char l : s) {
    letters.insert(l);
  }
  return letters.size();
}
long long count(string s, int d) {
  int n = s.length();
  int occ[26];
  for (int i = 0; i < 26; i++) {
    occ[i] = 0;
  }
  long long result = 0;
  int e1 = -1, e2 = -1, curr_d = 0;
  for (int p = 0; p < n; p++) {
    while ((e1 < p) || (e1 < n - 1 && curr_d < d)) {
      e1++;
      int chr = s[e1] - 'a';
      occ[chr]++;
      if (occ[chr] == 1) {
        curr_d++;
      }
    }
    while ((e2 < e1) || (e2 < n - 1 && occ[s[e2 + 1] - 'a'] > 0)) {
      e2++;
    }
    if (curr_d == d) {
      result += e2 - e1 + 1;
    }
    occ[s[p] - 'a']--;
    if (occ[s[p] - 'a'] == 0) {
      curr_d--;
    }
  }
  return result;
}
int main() {
  string s;
  cin >> s;
  int d = diversity(s);
  cout << d << endl;
  for (int i = 1; i <= d; i++) {
    cout << count(s, i) << endl;
  }
  return 0;
}
