#include <bits/stdc++.h>
using namespace std;
void dout() { cerr << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << H << ' ';
  dout(T...);
}
char s[500000];
pair<int, int> y[500000];
vector<long long> arr;
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; ++i) y[i].first = i, y[i].second = 0;
  for (int it = 1; it <= 26; ++it) {
    long long ans = 0;
    for (int i = 0, pos = 0, lastadd = 0, l = 0; i < len; ++i) {
      if (i > 0 && y[i].first == l) {
        ans += lastadd;
        y[i].first = y[i - 1].first, y[i].second = y[i - 1].second;
        continue;
      }
      if (y[i].first == len) break;
      l = y[i].first;
      y[i].second |= (1 << (s[y[i].first] - 'a'));
      while (pos < len && ((y[i].second & (1 << (s[pos] - 'a'))) != 0)) ++pos;
      ans += pos - l, lastadd = pos - l;
      y[i].first = pos;
    }
    if (ans == 0) break;
    arr.push_back(ans);
  }
  printf("%d\n", arr.size());
  for (int i = 0; i < arr.size(); ++i) printf("%I64d\n", arr[i]);
  return 0;
}
