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>.

"""
This is the solution of Binyamin Wieder to
Ilais' Weekly Challenge - Week 2.
"""

def main():

    #getting users input string
    s = input()

    #print("<output>")

    #making s all lowercase
    s = s.lower()

    #calculating s string diversity
    num_of_unique_letters = d(s)
    print(num_of_unique_letters)

    #find iterating through all diversitys until s diversity
    for i in range(1, num_of_unique_letters+1):

        #calculating number of substrings of s that have a diversity of exactly i.
        res = t(i, s)
        print(res)

    return 0


def d(s: str) -> int:
    """
    The d function calculates the diversity of a string.
    String diversity is the amount of unique characters that appear in that string.
    :param s: The string which the diversity is calculated for.
    :return: The diversity of s.
    """
    unique_chars = []

    for char in s:

        #checking if char is not in the unique_chars list
        if not (char in unique_chars):
            unique_chars.append(char)

    return len(unique_chars)


def t(i: int, s: str) -> int:
    """
    The t function calculates the amount of substrings of s that have a diversity of exactly i.
    :param i: The requested diversity.
    :param s: The string searched.
    :return: the amount of substrings of s that have a diversity of exactly i.
    """
    diversity_count_dict = {}

    string_len = len(s)

    #loop through all substrings
    for start_i in range(0, string_len+1):
        for end_i in range(start_i+1, string_len+1):

            #calculating diversity of substring
            diversity = d(s[start_i:end_i])

            #updating diversity_count_dict
            if diversity in diversity_count_dict:
                diversity_count_dict[diversity] += 1
            else:
                diversity_count_dict[diversity] = 1

    return diversity_count_dict.get(i)


if __name__ == "__main__":
    main()
