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>.
def insert(ch, tot, x):
    if x < 0 or x > 25:
        return tot
    if ch[x] == 0:
        tot += 1
    ch[x] += 1
    return tot

def erase(ch, tot, x):
    if x < 0 or x > 25:
        return tot
    ch[x] -= 1
    if ch[x] == 0:
        tot -= 1
    return tot

if __name__ == "__main__":
    s = input().strip()
    n = len(s)
    ch = [0] * 26
    tot = 0
    
    for i in range(n):
        tot = insert(ch, tot, ord(s[i]) - ord('a'))

    cnt = tot
    print(cnt)

    for i in range(1, cnt + 1):
        ch = [0] * 26
        tot = 0
        l = 0
        r1 = -1
        r2 = -1
        ans = 0

        while l < n and r1 < n:
            while r1 < n and tot < i:
                r1 += 1
                tot = insert(ch, tot, ord(s[r1]) - ord('a'))
            
            r2 = max(r2, r1)
            while r2 < n and ch[ord(s[r2]) - ord('a')] > 0:
                r2 += 1
            
            while l < n and tot == i:
                tot = erase(ch, tot, ord(s[l]) - ord('a'))
                l += 1
                ans += r2 - r1
        
        print(ans)# 1691535620.057062