Omar And Strings

Today while studying Omar reads many words in books and references. He feels bored enough to stop reading he has noticed something strange. All the words in some statement can be read the same from left to right and from right to left. Later, Omar discovered that this type of strings is called palindromic strings.

After some thinking Omar wants to create a new type of strings and gives that type a name derived from his name, so he invents a new type of strings and calls it omeric strings. Omar's friend Hazem loves prefixes and Eid loves suffixes so Omar will take this into consideration while inventing the new type. To make a string omeric from a string s you should concatenate the longest palindromic suffix with the longest palindromic prefix.

Then Omar wants to know how many times each prefix of his omeric string can be found in this string as a substring. Substring of the string can be defined by two indices L and R and equals sL sL+1...sR.

Input

The first line of the input contains a string s of length N, 1 ≤ N ≤ 105.

The given string consists only of lowercase characters.

Output

Print the omeric string in the first line. Print the frequency of each prefix in the second line.

Sample Input

aabb

Sample Output

bbaa
2 1 1 1

Explanation

Longest palindromic suffix equals "bb". Longest palindromic prefix equals "aa". Omeric string is "bbaa".

Only the first prefix "b" has appeared 2 times as a substring, while "bb", "bba", "bbaa" have appeared only 1 time in the omeric string.

Credit

Problem is stolen from hackerearth