#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g(30);
unordered_map<long long int, long long int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string str;
  cin >> str;
  int n = str.size(), cnt = 0;
  str = " " + str;
  for (int i = 1; i <= n; i++) {
    g[str[i] - 'a'].push_back(i);
    mp[str[i] - 'a']++;
    if (mp[str[i] - 'a'] == 1) cnt++;
  }
  cout << cnt << "\n";
  mp.clear();
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    vector<int> v;
    for (int j = 0; j < 26; j++) {
      int idx = lower_bound(g[j].begin(), g[j].end(), i) - g[j].begin();
      if (idx == g[j].size()) continue;
      v.push_back(g[j][idx]);
    }
    sort(v.begin(), v.end());
    int j = 1;
    for (j = 1; j < v.size(); j++) mp[j] += v[j] - v[j - 1];
    if (v.size()) mp[j] += n - v[v.size() - 1] + 1;
  }
  for (int i = 1; i <= cnt; i++) cout << mp[i] << "\n";
  return 0;
}
