cho.sh
Notes
Loading...

Make a Palindrome

Time limit

2s

Memory limit

128 MB

Problem

You are given a string S. Append zero or more characters to the end of S so that the whole string becomes a palindrome. A palindrome reads the same from left to right and from right to left.

Find the length of the shortest palindrome that can be made this way.

Input

The first line contains the string S. S consists only of lowercase English letters, and its length is at most 50.

Output

Print the length of the shortest palindrome that can be made by appending zero or more characters to the end of the string.