COCI '13 Contest 5 #1 Lozinka
View as PDFMirko is an evil plotting genius and has gotten hold of a list of all possible passwords for a certain user account. The first thing he noticed was all the passwords are of odd length. Mirko assumes that the correct password is the one which can be found in both the original and reverse order in the list. For example, if the word tulipan would be the correct password, the word napilut has to also appear in the list. Given that both words are correct passwords, Mirko will try to use both, one at a time.
Help Mirko discover what the correct password is and output its length and central character.
Input Specification
The first line of input contains the integer  
, the number of possible passwords.
Each of the following  lines contains a single word, its length being an odd number greater than 2 and less than 14. All characters are lowercase letters of the English alphabet.
Output Specification
The first and only line of output must contain the length of the correct password and its central letter. The solution will be unique.
Sample Input 1
4
las
god
psala
sal
Sample Output 1
3 a
Explanation for Sample Output 1
The required pair of words is las and sal. Their length is  letters and the central character is 
a.
Sample Input 2
4
kisik
ptq
tttrp
tulipan
Sample Output 2
5 s
Explanation for Sample Output 2
The word kisik can be found in both the original and reverse order on the list (the word is a palindrome), so it is a valid correct password.
Comments