def shortest_string_for_connected_components(S):
N = len(S)
# dp[k] will hold the minimum length of a string that results in exactly k connected components
dp = [float('inf')] * (N + 1)
dp[0] = 0 # 0 components require 0 length
# To track the positions of each character
from collections import defaultdict
# For each starting point
for l in range(N):
seen = set() # To track characters in the current substring
for r in range(l, N):
seen.add(S[r])
# The number of unique characters in the substring S[l:r+1]
unique_count = len(seen)
dp[unique_count] = min(dp[unique_count], r - l + 1)
# Prepare the result
result = []
for k in range(1, N + 1):
result.append(dp[k] if dp[k] != float('inf') else 0)
return result
# Read input
S = input().strip()
result = shortest_string_for_connected_components(S)
print(' '.join(map(str, result)))
ZGVmIHNob3J0ZXN0X3N0cmluZ19mb3JfY29ubmVjdGVkX2NvbXBvbmVudHMoUyk6CiAgICBOID0gbGVuKFMpCiAgICAKICAgICMgZHBba10gd2lsbCBob2xkIHRoZSBtaW5pbXVtIGxlbmd0aCBvZiBhIHN0cmluZyB0aGF0IHJlc3VsdHMgaW4gZXhhY3RseSBrIGNvbm5lY3RlZCBjb21wb25lbnRzCiAgICBkcCA9IFtmbG9hdCgnaW5mJyldICogKE4gKyAxKQogICAgZHBbMF0gPSAwICAjIDAgY29tcG9uZW50cyByZXF1aXJlIDAgbGVuZ3RoCiAgICAKICAgICMgVG8gdHJhY2sgdGhlIHBvc2l0aW9ucyBvZiBlYWNoIGNoYXJhY3RlcgogICAgZnJvbSBjb2xsZWN0aW9ucyBpbXBvcnQgZGVmYXVsdGRpY3QKICAgIAogICAgIyBGb3IgZWFjaCBzdGFydGluZyBwb2ludAogICAgZm9yIGwgaW4gcmFuZ2UoTik6CiAgICAgICAgc2VlbiA9IHNldCgpICAjIFRvIHRyYWNrIGNoYXJhY3RlcnMgaW4gdGhlIGN1cnJlbnQgc3Vic3RyaW5nCiAgICAgICAgZm9yIHIgaW4gcmFuZ2UobCwgTik6CiAgICAgICAgICAgIHNlZW4uYWRkKFNbcl0pCiAgICAgICAgICAgICMgVGhlIG51bWJlciBvZiB1bmlxdWUgY2hhcmFj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