Matching Palindrome
메모리 제한1024 MB
팰린드롬 P가 주어질 때, P 뒤에 붙여 팰린드롬이 되는 가장 짧은 비어 있지 않은 팰린드롬 Q를 구한다.
문제
You are given a palindrome string of length consisting of only lowercase letters of the English alphabet. Find the shortest non-empty palindrome string such that concatenated with forms a palindrome. Formally, the string forms a palindrome.
입력
The first line of the input gives the number of test cases, . test cases follow. Each test case consists of two lines. The first line of each test case contains an integer denoting the length of the string . The second line of each test case contains a palindrome string of length .
출력
For each test case, output one line containing Case #x: y, where is the test case number (starting from 1) and is the non-empty palindrome string as described above.
제한
- .
- String is a palindrome consisting of only lowercase letters of the English alphabet.