|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
Description
Palindrome is a string that is identical to its reverse, like "level" or "aba". Given a string, find the longest palindrome in the string.
Input
the first line of the input is a integer N, indicating the number of test cases.
In the next N lines, each contains a string. The length of each string is less than 1000. The number of test case is less than or equal to 10.
Output
In each test case, output the longest palindrome in the string. If there are many palindromes of the same length, output the first one in the string.
Tags