#P7672. Reversed String Pair

    ID: 20862 Type: Default 1000ms 256MiB

Reversed String Pair

Reversed String Pair

Given a list of odd-length strings, find one string \(s\) such that its reverse \(s^R\) is also present in the list. Formally, if \(s = s_0s_1\dots s_{n-1}\), then its reverse is \(s^R = s_{n-1}\dots s_1s_0\). Once such a string is found, output its length and the character located at its center.

Note: Since the length is always odd, the middle character is at index \(\lfloor n/2 \rfloor\).

inputFormat

The first line contains an integer \(n\), the number of strings. The following \(n\) lines each contain a non-empty string with odd length.

outputFormat

Output two items separated by a space: the length of the chosen string and its middle character.

sample

2
abc
cba
3 b