Codeforces Round 427 (Div. 2)
D
Palindromic characteristics
Codeforces
1900
原题
← CE →
翻译中…

Palindromic characteristics of string $*s*$ with length $|*s*|$ is a sequence of $|*s*|$ integers, where $*k*$-th number is the total number of non-empty substrings of $*s*$ which are $*k*$-palindromes.

翻译中…

A string is $1$-palindrome if and only if it reads the same backward as forward.

翻译中…

A string is $*k*$-palindrome ($*k* > 1$) if and only if:

翻译中…
  1. Its left half equals to its right half.
  2. Its left and right halfs are non-empty ($*k* - 1$)-palindromes.
翻译中…

The left half of string $*t*$ is its prefix of length $⌊|*t*| / 2⌋$, and right half — the suffix of the same length. $⌊|*t*| / 2⌋$ denotes the length of string $*t*$ divided by $2$, rounded down.

翻译中…

Note that each substring is counted as many times as it appears in the string. For example, in the string "aaa" the substring "a" appears 3 times.

翻译中…

Input

翻译中…

The first line contains the string $*s*$ ($1 ≤ |*s*| ≤ 5000$) consisting of lowercase English letters.

翻译中…

Output

翻译中…

Print $|*s*|$ integers — palindromic characteristics of string $*s*$.

翻译中…

Note

翻译中…

In the first example 1-palindromes are substring «a», «b», «b», «a», «bb», «abba», the substring «bb» is 2-palindrome. There are no 3- and 4-palindromes here.

翻译中…

样例

Input #1
abba
Output #1
6 1 0 0
InputCopy OutputCopy
Input #2
abacaba
Output #2
12 4 1 0 0 0 0
InputCopy OutputCopy
题目信息
题号
835D
时间限制
3 s
内存限制
256 MB
标签
暴力
动态规划
哈希
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。