s = list(input()) n = len(s) z = [0] * n z[0] = n l = r = 0 i = 1 while i < n: if i > r: j = 0 while (j + i < n) and (s[i + j] == s[j]): z[i] = j j += 1 l = i r = i + j - 1 else: if z[i - l] < r - i + 1: z[i] = z[i - l] else: j = 1 while j + r < n and s[r + j] == s[r - i + j]: z[i] = r - i + j l = i r = r + j - 1 j += 1 i += 1 print(z)