#K44887. Find the Largest Palindromic String
Find the Largest Palindromic String
Find the Largest Palindromic String
You are given a list of strings. Your task is to find the largest string that is a palindrome. A string is considered a palindrome if it reads the same backward as forward (this check is case insensitive). If no palindromic string exists, output an empty string. If the input is not valid, output None
.
The input is provided via standard input. The first line contains an integer \(N\), which is the number of strings. The following \(N\) lines each contain one string.
inputFormat
The input is given in the following format:
- The first line contains an integer \(N\) (if this line cannot be parsed as an integer or if \(N < 0\), the input is considered invalid).
- The next \(N\) lines each contain a string.
outputFormat
Output the largest palindromic string. If there is no palindrome among the given strings, output an empty string. If the input is invalid, output None
.
4
racecar
level
world
abba
racecar