#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 lines:
Line contains an integer , representing the number of given strings.
Lines to each contain one string.
Output Format
Output a total of 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 , 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 of the testdata, , string length . 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 .
This problem is translated from COCI2013_2014 CONTEST #5 T1 LOZINKA.
Translated by ChatGPT 5
京公网安备 11011102002149号