Matching Palindrome

아직 제출이 없습니다메모리 제한1024 MB

문제

You are given a palindrome string P\mathbf{P} of length N\mathbf{N} consisting of only lowercase letters of the English alphabet. Find the shortest non-empty palindrome string QQ such that P\mathbf{P} concatenated with QQ forms a palindrome. Formally, the string PQ\mathbf{P}Q forms a palindrome.

입력

The first line of the input gives the number of test cases, T\mathbf{T}. T\mathbf{T} test cases follow. Each test case consists of two lines. The first line of each test case contains an integer N\mathbf{N} denoting the length of the string P\mathbf{P}. The second line of each test case contains a palindrome string P\mathbf{P} of length N\mathbf{N}.

출력

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 1) and yy is the non-empty palindrome string QQ as described above.

제한

  • 1T1001 \le \mathbf{T} \le 100.
  • String P\mathbf{P} is a palindrome consisting of only lowercase letters of the English alphabet.