#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long expo_pow(long long x, long long y) {
  if (y == 0) return 1;
  y = y % (mod - 1);
  x %= mod;
  if (y == 0) y = mod - 1;
  long long res = 1;
  while (y) {
    if (y & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    y >>= 1;
  }
  return res;
}
long long add() { return 0; }
template <typename T, typename... Types>
T add(T var1, Types... var2) {
  return (((((long long)(var1)) % mod + (long long)(add(var2...))) % mod) +
          mod) %
         mod;
}
long long mul() { return 1; }
template <typename T, typename... Types>
T mul(T var1, Types... var2) {
  return (((long long)(var1)) % mod * (long long)(mul(var2...))) % mod;
}
void solve() {
  string str;
  cin >> str;
  long long ans[26] = {0};
  long long n = str.length();
  for (long long i = 0; i < 26; i++) {
    long long dis = i + 1;
    long long cnt[26] = {0};
    long long let = 0;
    long long r = 0;
    for (long long l = 0; l < n; l++) {
      while (r < n and let <= dis) {
        if (cnt[str[r] - 'a'] == 0) let++;
        if (let > dis) {
          let--;
          break;
        }
        cnt[str[r] - 'a']++;
        r++;
      }
      ans[i] += (r - l);
      cnt[str[l] - 'a']--;
      if (cnt[str[l] - 'a'] == 0) {
        let--;
      }
    }
  }
  vector<long long> fin_ans;
  fin_ans.push_back(ans[0]);
  for (long long i = 1; i < 26; i++) {
    if (ans[i] == ans[i - 1]) break;
    fin_ans.push_back(ans[i] - ans[i - 1]);
  }
  cout << fin_ans.size() << "\n";
  for (auto u : fin_ans) cout << u << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long test = 1;
  long long i = 1;
  while (test--) {
    solve();
  }
}
