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>.
from collections import defaultdict

s = input()
n = len(s)

# Calculate the diversity of s
d = len(set(s))

# Initialize a dictionary to store the count of substrings with each diversity
count = defaultdict(int)

# Initialize two pointers to traverse the string
left = 0
right = 0

# Initialize a set to store the unique characters in the current substring
unique_chars = set()

# Traverse the string and count the substrings with each diversity
while right < n:
    # Add the current character to the set of unique characters
    unique_chars.add(s[right])

    # If the diversity of the current substring is greater than d, move the left pointer
    while len(unique_chars) > d:
        unique_chars.remove(s[left])
        left += 1

    # Update the count of substrings with the current diversity
    count[len(unique_chars)] += (n - right)

    # Move the right pointer
    right += 1

# Print the diversity of s
print(d)

# Print the count of substrings with each diversity
for i in range(1, d+1):
    print(count[i])