A palindrome is a word or sentence that reads the same forward as it does backward.
The words a and I are perhaps the simplest and least interesting palindromes; the word racecar and the name Hannah are more interesting and illustrative. Neither spaces nor punctuation are usually taken into consideration when constructing sentences that are palindromes — one of the most famous palindromes is “A man, a plan, a canal, Panama” — but when the spaces are properly positioned as well, so much the better. An example would be the also famous palindrome “Able was I ere I saw Elba,” purportedly spoken by Napoleon, referring to his first sighting of Elba, the island where the British exiled him.
Palindromes are a type of palingram called letter palingrams. A palingram is a sentence in which the letters, syllables, or words read the same backward as they do forward. The sentence, “He was, was he?” is a word palingram, because the words can be placed in reverse order and still read the same. The sentence, “I did, did I?” is not only a word palingram but a letter palingram (or palindrome) as well.