Broken palindromes

(The original statement in Catalan has some jokes. This English version
goes straight to the point of the problem.)

A palindrome has been broken into pieces. Put the pieces together in the
right order.

Input

Input consists of several cases. Every case begins with the number of
pieces n. Follow the n pieces, made up of only lowercase letters. Assume
1 ≤ n ≤ 8.

Output

For every case, print the palindrome that can be made by joining all the
pieces. There is always exactly one solution.

Problem information

Author: Alex Alvarez

Generation: 2026-01-25T11:17:41.230Z

© Jutge.org, 2006–2026.
https://jutge.org
