#P7672. [COCI 2013/2014 #5] LOZINKA

[COCI 2013/2014 #5] LOZINKA

Description

You are given some strings of odd length. Please find a string such that its reversed string is also among the given strings.

For example, for the string abcca, if it satisfies the requirement, then the string accba must also appear in the input strings.

Output the length of this string and the character in its exact middle position.

Input Format

The input contains a total of n+1n+1 lines:

Line 11 contains an integer nn, representing the number of given strings.

Lines 22 to n+1n+1 each contain one string.

Output Format

Output a total of 11 line: an integer and a character, separated by a space, representing the length of a valid string and the character in the middle of the string.

4
las
god
psala
sal 
3 a
4
kisik
ptq
tttrp
tulipan
5 s

Hint

[Sample Explanation #1]

las and sal form a valid pair. The length is 33, and the middle character is a.

[Sample Explanation #2]

kisik is a palindrome. Its reversed string is still kisik, so it satisfies the requirement.

[Constraints]

For 100%100\% of the testdata, 1n1001 \le n \le 100, 33 \le string length 13\le 13. All strings consist of lowercase letters. It is guaranteed that the answer is unique.

[Notes]

The score of this problem follows the original COCI setting. The full score is 5050.

This problem is translated from COCI2013_2014 CONTEST #5 T1 LOZINKA.

Translated by ChatGPT 5