#include <bits/stdc++.h>
using namespace std;
const int alfa = 50;
int positions[alfa];
long long res[alfa];
int Size;
void Delete(int x) {
  for (int i = x + 1; i <= Size; i++) positions[i - 1] = positions[i];
  Size--;
  return;
}
int main() {
  string s;
  getline(cin, s);
  for (int i = 0; i < alfa; i++) res[i] = 0;
  Size = 0;
  positions[0] = s.length();
  for (int i = s.length() - 1; i >= 0; i--) {
    for (int j = 1; j <= Size; j++)
      if (s[positions[j]] == s[i]) Delete(j);
    Size++;
    positions[Size] = i;
    for (int j = Size; j > 0; j--) {
      res[Size - j + 1] += long(positions[j - 1]) - long(positions[j]);
    }
  }
  cout << Size << endl;
  for (int i = 1; i <= Size; i++) cout << res[i] << endl;
  return 0;
}
