#C33. Unique Palindromes

    ID: 46711 Type: Default 1000ms 256MiB

Unique Palindromes

Unique Palindromes

You are given a list of strings. Your task is to filter out and output only those strings that are palindromes, while preserving the order in which they first appear. A palindrome is a string which reads the same backward as forward.

Note: If a palindrome appears more than once, only its first occurrence should be included in the output.

For example, given the list ["madam", "racecar", "apple", "madam", "rotor"], the output should be "madam racecar rotor" because "madam" appears twice but is only printed once, and "apple" is not a palindrome.

Additionally, if no palindromes are found, output an empty line.

In mathematical terms, for a string \( s \) of length \( n \), it is a palindrome if \( s[i] = s[n-i+1] \) for all \( 1 \leq i \leq n \), using \( \LaTeX \) style for formulas.

inputFormat

The first line of input contains an integer \( n \), the number of strings.

Each of the following \( n \) lines contains a single non-empty string.

outputFormat

Output a single line with the unique palindromic strings separated by a single space, maintaining the order of their first appearance. If there are no valid palindromes, output an empty line.

## sample
5
madam
racecar
apple
madam
rotor
madam racecar rotor

</p>