1831: The Palindrome

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:10 解决:4

题目描述

John and Brus are studying string theory at the university. Brus likes palindromes very much. A palindrome is a word that reads the same forward and backward. John would like to surprise Brus by taking a String s, and appending 0 or more characters to the end of s to obtain a palindrome. He wants that palindrome to be as short as possible. And since you are as clever as God,he asks you for help.

输入

Each line is a case. Each case contains a string s. Each string will contain between 1 and 50 characters,inclusive. Each character of s will be a lowercase letter(‘a‘-‘z‘).

输出

output the shortest possible length of a palindrome that John can generate for each case.

样例输入 复制

abab
abacaba
qwerty
abdfhdyrbdbsdfghjkllkjhgfds

样例输出 复制

5
7
11
38