#include <bits/stdc++.h>
using namespace std;
char cad[300010];
long long dp[300001][27][2];
int main() {
  scanf("%s", cad);
  int n = strlen(cad);
  for (int i = 0; i <= n; i++) dp[i][0][0] = 1;
  vector<long long> resp;
  long long sum;
  for (int k = 1; k <= 26; k++) {
    sum = 0;
    for (int i = 1; i <= n; i++) {
      if ((dp[i - 1][k - 1][1] & (1 << (cad[i - 1] - 'a'))) == 0) {
        dp[i][k][0] += dp[i - 1][k - 1][0];
        dp[i][k][1] = dp[i - 1][k - 1][1] | (1 << (cad[i - 1] - 'a'));
      }
      if ((dp[i - 1][k][1] & (1 << (cad[i - 1] - 'a'))) != 0) {
        dp[i][k][0] += dp[i - 1][k][0];
        dp[i][k][1] = dp[i - 1][k][1];
      }
      sum += dp[i][k][0];
    }
    if (sum != 0) resp.push_back(sum);
  }
  printf("%d\n", (int)resp.size());
  for (int i = 0; i < resp.size(); i++) printf("%lld\n", resp[i]);
  return 0;
}
