#include <bits/stdc++.h>
using namespace std;
long long int ans[27];
int ct[26];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  string s;
  cin >> s;
  memset(ans, 0, sizeof ans);
  int n = s.size();
  for (int sz = 1; sz <= 26; ++sz) {
    int p_c = 0;
    int j = 0;
    memset(ct, 0, sizeof ct);
    for (int i = 0; i < n; ++i) {
      if (ct[s[i] - 'a'] == 0) {
        ++p_c;
      }
      ++ct[s[i] - 'a'];
      while (p_c > sz) {
        --ct[s[j] - 'a'];
        if (ct[s[j] - 'a'] == 0) {
          --p_c;
        }
        ++j;
      }
      ans[sz] += i - j + 1;
    }
  }
  vector<long long int> f_v{};
  int mm = 26;
  for (int i = 1; i <= 26; ++i) {
    f_v.push_back(ans[i] - ans[i - 1]);
    if (f_v.back() == 0) {
      mm = i - 1;
      break;
    }
  }
  cout << mm << endl;
  for (int i = 1; i <= mm; ++i) {
    cout << f_v[i - 1] << endl;
  }
  return 0;
}
