eolymp
bolt
Try our new interface for solving problems
Problems

Palindrome

Palindrome

Time limit 1 second
Memory limit 128 MiB

You are given a non-empty string consisting of lowercase Latin letters. It is allowed to add characters to the beginning and to the end of the string. Add the minimum number of characters to get a palindrome.

Recall that a palindrome is a string that reads the same from left to right and from right to left.

Input data

One line consisting of small Latin letters. The string length is from 1 to 10^6 characters.

Output data

Print the minimum number of characters that must be added to the original string to get a palindrome.

Examples

Input example #1
bab
Output example #1
0