String diversity is the number of symbols that occur in the string at least once. Diversity of *s* will be denoted by *d*(*s*). For example , *d*("aaa")=1, *d*("abacaba")=3.

Given a string *s*, consisting of lowercase Latin letters. Consider all its substrings. Obviously, any substring diversity is a number from 1 to *d*(*s*). Find statistics about substrings diversity: for each *k* from 1 to *d*(*s*), find how many substrings of *s* has a diversity of exactly *k*.
The input consists of a single line containing *s*. It contains only lowercase Latin letters, the length of *s* is from 1 to 3·10<sup class="upper-index">5</sup>.
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    string s;
    set<char> st;
    vector<int> vec[26];
    int it[26] = {0};
    ll ans[26] = {0};
 
    cin >> s;
 
	int n = (int)s.size();
 
	for(int i=0;i<n;i++){
		st.insert(s[i]);
		vec[s[i]-'a'].push_back(i);
	}
 
	for(int i=0;i<n;i++){
		vector<int> vec2;
		for(int j=0;j<26;j++){
			if(it[j] < (int)vec[j].size()){
				vec2.push_back(vec[j][it[j]]);
			}
		}
		sort(vec2.begin(), vec2.end());
		vec2.push_back(n);
		int cur = 0;
		int pos = i;
		for(auto v : vec2){
			ans[cur] += v-pos;
			pos = v;
			cur++;
		}
		it[s[i]-'a']++;
	}
 
	cout << st.size() << "\n";
 
	for(int i=1;i<=(int)st.size();i++){
		cout << ans[i] << "\n";
	}
 
	return 0;
}