pal-fantasy-1
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

A palindrome is a word that reads the same forward and backward. Given a string s, you need to make it a palindrome by adding 0 or more characters to the end of s, and remember, we want the palindrome to be as short as possible.

INPUT

First line is T, the number of test cases. T strings follow, every string s needs to be converted to palindrome.

OUTPUT

Print the shortest possible length of a palindrome that John can generate.

CONSTRAINTS
1 ≤ T ≤ 50
s will contain between 1 and 50 characters,
   inclusive, palindrome can be larger in length. Each character of s
   will be a lowercase letter ('a' - 'z').

SAMPLE INPUT
3
abab
abacaba
qwerty

SAMPLE OUTPUT
5
7
11


def cp(sa):
	n=len(sa)
	st=""
	for i in range(n-1,-1,-1):
		st+=sa[i]
	return st==sa
t=eval(input())
for c in range(0,t):
	s=input()
	n=len(s)
	if(cp(s)):
		print(n)
		continue
	mlength=2*n
	for i in range(n,mlength):
		st=s+s[i-n::-1]
		#print st
		if(cp(st)):
			print(len(st))
			break


for _ in range(int(input())):
	s=input()
	r=s[-1::-1]
	if(r==s):
		print((len(s)))
	else:
		for i in range(1,len(s)):
			t=s
			t+=(s[:i])[-1::-1]
			if(t[-1::-1]==t):
				print((len(t)))
				break