Problem list
Log in
#coci00299 · COCI 2013/2014 Contest 5

Lozinka

Bronze I 1.0 s 32 MB

Mirko 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

The first line of input contains the integer N ($1 \le N \le 100$), 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. The solution will be unique.

Example 1

Input
4
las
god
psala
sal
Output
3 a

Example 2

Input
4
kisik
ptq
tttrp
tulipan
Output
5 s

Clarification of the first example: The required pair of words is “las” and “sal”. Their length is 3 letters and the central character is 'a'. Clarification of the second example: 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.

Source
COCI 2013/2014 Contest 5
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code