pal-fantasy
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


tc=int(input())
for case in range(tc):
	s=list(map(str,input()))
	l=len(s)
	for i in range(l):
		a=s[i:]
		b=a[::-1]
		if a==b:
			break
	print(l+i)
		


T = int(input())

def main(s):
	for i in range(len(s)):
		t = s + s[:i][::-1]
		if t == t[::-1]:
			return len(t)

for i in range(T):
	print(main(input()))