password-1

Danny has a possible list of passwords of Manny's facebook account. All passwords length is odd. But Danny knows that Manny is a big fan of palindromes. So, his password and reverse of his password both should be in the list.    

You have to print the length of Manny's password and it's middle character.   

Note : The solution will be unique.

INPUT 
The first line of input contains the integer N, the number of possible passwords.  
Each of the following N lines contains a single word, its length being an odd number greater than 2
and lesser than 14. All characters are lowercase letters of the English alphabet.     

OUTPUT 
The first and only line of output must contain the length of the correct password and its central letter.

CONSTRAINTS 
1 ≤ N ≤ 100   

SAMPLE INPUT
4
abc
def
feg
cba

SAMPLE OUTPUT
3 b

Difficulty: EASY
Tags: Ad-hoc

Data structures

Complete search
Skill types: Data structures

Complete search

Starter code:

Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'

n = int(input())
passwd_dict = {}

# We check in the dict for ach string, if the revers eid there or not
# and return accordingly

for i in range(0, n):
	str1 = input().strip()
	rev_str1 = str1[::-1]
	if passwd_dict.get(rev_str1, None):
		print(len(str1), str1[len(str1)/2])
		break
	passwd_dict[str1] = 1


def password():
	t = eval(input())

	l = []

	for i in range(t):
		x = input()
		l.append(x)
	
	for x in l:
		for y in l:
			if(x == y[::-1]):
				print(len(x),x[len(x)/2])
				return 
password()



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n = int(input())
list = []
for i in range(n):
	s = input()
	if s in list:
		print('%d %s' % (len(s), s[len(s)/2]))
		break
	list.append(s[::-1])
	


import itertools
a = int(input())
c=[]
outt=[]
for x in range(a):
	b = input()
	c.append(b)


for i in itertools.combinations(c,2):
	if i[0] == i[1][::-1]:
		alpha = len(i[0])/2
		print(len(i[0]), i[0][alpha])


n = int(input())
pwdlist=[]
while n:
	pwdlist.append(input())
	n-=1

for i in pwdlist:
	if i[::-1] in pwdlist:
		print(len(i),i[len(i)//2])
		break


n = eval(input());
s= [];

while n:
	n-=1;
	
	pw = input();
	s.append(pw);
	
	rpw = pw[::-1];
	
	if(rpw in s ):
		print(repr(len(pw)) + " " + pw[(len(pw)/2)]);


a=[]
for i in range(eval(input())):
	a.append(input())
flag=0	
for i in range(len(a)-1):
	a[i]=a[i][::-1]
	for j in range(i+1,len(a)):
		if a[i]==a[j]:
			print(len(a[j]), end=' ')
			print(a[i][len(a[i])/2])
			flag+=1
			break
	if(flag):
		break


n = int(input().strip())
d0 = {}
for i in range(0, n):
	str1 = input().strip()
	str2 = str1[::-1]
	if d0.get(str2, None):
		print(len(str1), str1[len(str1)/2])
		break
	d0[str1] = 1


n=eval(input())
dic={}
for i in range(n):
	passwd = input()
	dic[passwd] = 1
	try:
		if dic[passwd[::-1]] == 1:
			l=len(passwd)
			print(l, passwd[l/2])
	except KeyError:
		continue


n=eval(input())
dic={}
for i in range(n):
	passwd = input()
	dic[passwd] = 1
	try:
		if dic[passwd[::-1]] == 1:
			l=len(passwd)
			print(l, passwd[l/2])
	except KeyError:
                continue


a=[]
n=eval(input())
for i in range(n):
	a.append(input())
for i in range(n):
	for j in range(i+1,n):
		if a[i]==a[j][::-1]:
			print(len(a[i]),a[i][len(a[i])/2])



a=[]
n=eval(input())
flag=0
for i in range(n):
	a.append(input())
for i in range(n):
	for j in range(i+1,n):
		if a[i]==a[j][::-1]:
			print(len(a[i]), end=' ')
			print(a[i][len(a[i])/2])



N=int(input())
a=[]
b=[]
for i in range(N):
	a.append(input())
i=0
for i in range (N):
	q=a[i]
	c=q[::-1]
	b.append(c)
for j in range(N):
		if a[j] in b:
			p=a[j]
c=len(p)
print(c,p[c/2])


N=int(input())
li=[]
for _ in range (N):
	passwrd=input()
	li.append(passwrd)

for _ in range(N):
	i=_+1
	while i != N:
		if li[_][::-1]==li[i]:
			print("%d %s"%(len(li[_]),li[_][len(li[_])/2]))
			break
		i+=1


n=eval(input())
dic={}
for i in range(n):
	passwd = input()
	dic[passwd] = 1
	try:
		if dic[passwd[::-1]] == 1:
			l=len(passwd)
			print(l, passwd[l/2])
	except KeyError:
		continue


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n = eval(input())
d ={}
for p in range(n):
	pwd = input()
	l = len(pwd)
	r_pwd = pwd[::-1]
	
	if r_pwd in d:
		print(l,pwd[(l-1)/2])
	else:
		d[pwd] = 1

# for pwd in p_list:
	
# 	l = len(pwd)
# 	r_pwd = pwd[::-1]
# 	filter(lambda x:x == )


num_cases = int(input().rstrip("\n"))
input_set = set([])
output = ''
for count in range(num_cases):
	input = input().rstrip("\n")
	input_set.add(input)
	if (input_set.__contains__(input[::-1])):
		output = input[::-1]
print("%d %s" % (len(output), output[len(output)/2]))


def reverse(s):
	rev = ''
	for i in range(len(s)):
		rev = rev + s[len(s) - i - 1]
	return rev

num_cases = int(input().rstrip("\n"))
input_set = set([])
output = ''
for count in range(num_cases):
	input = input().rstrip("\n")
	input_set.add(input)
	if (input_set.__contains__(reverse(input))):
		output = reverse(input)
print("%d %s" % (len(output), output[len(output)/2]))


 
a=int(input())
li=[]
for i in range(a):
	li.append(input())
for el in li:
	rev=el[::-1]
	if rev in li:
		print(len(el),el[len(el)/2],sep=" ")
		break


def getpass(N):
	possibles = []
	newN = 0
	for i in range(N):
		newpossible = input()
		if len(newpossible)%2==1:
			possibles.append(newpossible)
			newN+=1
	for i in range(newN):
		for j in range(newN):
			if i!=j:
				if possibles[i]==possibles[j][::-1]:
					return "%d %s"%(len(possibles[i]), possibles[i][len(possibles[i])/2])

if __name__ == "__main__":
	N = int(input())
	print(getpass(N))


n=eval(input())
dic={}
for i in range(n):
	passwd = input()
	dic[passwd] = 1
	try:
		if dic[passwd[::-1]] == 1:
			l=len(passwd)
			print(l, passwd[l/2])
	except KeyError:
		continue


d = {}
r = []
t = int(input())
for i in range(t):
	r.append(input())
	
for e in r:
	if e[::-1] in d:
		print(len(e) , e[len(e)/2])
		break
	else:
		d[e] = 1


import math
n = int(input())
alist = []
for _ in range(n):
    
	word = input()
	alist.append(word)

for word in alist:
	word = list(word)
	word = word[::-1]
	word = "".join(word)
	if(word in alist):
		mid = int(math.ceil(len(word)/2.0))
		print(len(word), word[mid-1])
		break
	
		
		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def password(input_list):
	for i in input_list:
		if i[::-1] in input_list:
			return i
tests=eval(input())
input_list=[input() for i in range(tests)]
i=password(input_list)
x=len(i)
print(x,i[x/2])


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
password = []
for i in range(int(input())):
	password.append(input())
for i in password:
	if i[::-1] in password:
		print(len(i), i[len(i)//2])
		break


t = int(input())
d = {}
while t!=0:
	t-=1
	pwd = input()
	n = pwd[::-1]
	if n in d:
		l = len(n)
		print(l,n[(l-1)/2])
	else:
		d[pwd] = 1


n=int(input())
l=[]
for i in range(n):
	a=input()
	l.append(a)
for item in l:
	rev_item=item[::-1]
	if rev_item in l:
		mid_index=len(rev_item)/2
		ans=rev_item[mid_index]
		print(len(rev_item),ans)
		break


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

def rev(string):
	return string[::-1]
	
	
list=[]
n= int(input('\n'))
for num in range(n):
	m=input()
	list.append(m)
	print ('\n')
	
for num in range(len(list)):
	if list[num] and rev(list[num]) in list:
		mid=len(list[num])/2 
		print(len(list[num]),list[num][int(mid)])
		break


N=int(input())
li=[]
for _ in range (N):
	passwrd=input()
	li.append(passwrd)

for _ in range(N):
	i=_+1
	while i != N:
		if li[_][::-1]==li[i]:
			print("%d %s"%(len(li[_]),li[_][len(li[_])/2]))
			break
		i+=1


def palindrome(y):
	if y[::-1] in temp:
		return 0
	else:
		return 1
	
N = eval(input())
temp = []
for i in range(0,N):
	x = input()
	temp.append(x)
for i in range(0,N/2+1):
	if palindrome(temp[i])== 0:
		z = temp[i]
		w = len(z)
		print(w,z[len(z)/2])
		break
	else:
		continue


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
tc = eval(input())
list1=[]
while tc >0:
	str = input()
	list1.append(str)
	tc -=1
for pswd in list1:
	if pswd[::-1] in list1:
		print(len(pswd), pswd[len(pswd)/2])
		break


c = int(input())
temp = []
for i in range(c):
	a = input()
	if a in temp:
		leng = len(a)
		midd = a[len(a) // 2]
	temp.append(a[::-1])

print("%i %s" %(leng,midd))