#include <bits/stdc++.h>
using namespace std;
const int N = 300001;
long long dp[N][27], cnt[27];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int ds = 0, n = s.size();
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 26; ++j) {
      if (s[i - 1] == j + 'a')
        dp[i][j] = i;
      else
        dp[i][j] = dp[i - 1][j];
    }
  for (int i = 1; i <= n; ++i) {
    vector<int> z;
    for (int j = 0; j < 26; ++j)
      if (dp[i][j]) z.push_back(dp[i][j]);
    int d = z.size();
    if (i == n) ds = d;
    z.push_back(0);
    sort(z.begin(), z.end());
    for (int j = 1; j < z.size(); ++j, --d) cnt[d] += z[j] - z[j - 1];
  }
  cout << ds << "\n";
  for (int i = 1; i <= ds; ++i) cout << cnt[i] << "\n";
}
