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>.
import string, random

test = "aka"

def bog(stri):
    used = [0 for _ in range(26)]
    count = 0
    global gcount

    for s in stri:
        used[ord(s)-97] += 1

    for a in used:
        if a > 0:
            count += 1

    return count, used

gcount, gused = bog(test)

boglist = {}
for l in range(gcount+1):
    boglist[l] = 0

boglist[1] = len(test)
boglist[gcount] = 1

def split(stri):
    l = 2
    c, u = bog(stri[0:2])
    boglist[c]+=1
    #print(c)
    ok = 0
    while True:
        for x in range(len(stri) - l):
            try:
                new = ord(stri[x + l]) - 97
                old = ord(stri[x]) - 97
            except Exception as e:  
                print(l, x)
            #print(c, l, x, chr(old+97), chr(new+97), ">")
            
            if(new != old):

                u[new] += 1
                u[old] -= 1

                if(u[new] == 1): c += 1
                if(u[old] == 0): c -= 1
            boglist[c] += 1 
            
        
        l += 1
        x+=1
        if l == len(stri): break

        new = ord(stri[x - 1]) - 97
        u[new] += 1

        if(u[new] == 1): c += 1
        #print(c, l, x, chr(old+97), chr(new+97), "<=")
        boglist[c] += 1 

        for x in reversed(range(len(stri) - l)):
            try:
                new = ord(stri[x]) - 97
                old = ord(stri[x + l]) - 97
            except Exception as e:  
                print(l, x)
            
            #print(c, l, x, chr(old+97), chr(new+97), "<")
            if(new != old):

                u[new] += 1
                u[old] -= 1

                if(u[new] == 1): c += 1
                if(u[old] == 0): c -= 1
            boglist[c] += 1 

        l += 1
        if l == len(stri): break
        new = ord(stri[1 + l]) - 97

        u[new] += 1 

        if(u[new] == 1): c += 1
        boglist[c] += 1 

        
        

split(test)
        
for x, y in boglist.items():
    print(y)