eolymp
bolt
Try our new interface for solving problems
Problems

Incomplete palindromes

Incomplete palindromes

It became known that enemy uses its own message encryption algorithm. To do this, additional words are added to arbitrary text between words, which record the data that needs to be transmitted. In order to make it clear in which words the messages are written, these words form "incomplete palindromes". An "incomplete palindrome" is formed by adding the same word to a word, but in reverse order. After that, the last letter in the palindrome word is removed.

Using the given text, decrypt the message written in it.

It is known that the message is formed as a set of words encoded by "incomplete palindromes". The minimum length of words included in the ciphertext is 3 characters.

Input

One string no longer than 10000 characters, consisting of lowercase Latin letters and spaces.

Output

Print the decrypted message or the number "-1" if the text does not contain the encrypted message.

Time limit 1 second
Memory limit 128 MiB
Input example #1
lorem ipsum is simply  thissih dummy text of the printing and messageegasse typesetting industry
Output example #1
this message
Source ІІ stage of All-Ukrainian informatics olympiad in Zhitomyr region 17.12.2022