#C14206. Identify Palindromes
Identify Palindromes
Identify Palindromes
You are given a list of words. Your task is to output only those words that are palindromes. A palindrome is a word that reads the same forwards and backwards, ignoring case. For example, Racecar
and Level
are palindromes.
The input is read from standard input. The first line contains an integer n specifying the number of words. Each of the following n lines contains one word. The output should be printed to standard output in one line, with the palindromic words separated by a single space. The order of the output words should follow the order in the input.
If there are no palindromic words, output an empty line.
inputFormat
The first line of input contains a positive integer n
(n ≥ 0) which indicates the number of words. The following n
lines each contain one word. Words consist only of alphabetic characters.
outputFormat
Print a single line containing all the palindromic words found in the input separated by a single space. If no palindromic words are found, print an empty line.
## sample5
Racecar
Ana
Level
rotor
civic
Racecar Ana Level rotor civic