Our next contest is:
Tuesday, March 31, 2009
Palindromes
Jake was walking down the street one day when he
started playing with words. He started
to look for different patters that words can contain. One pattern which he found fascinating was
words that are spelled the same both forwards and backwards. These words are called palindromes. He began to think of what words are
palindromes, and came up with a long list.
This got Jake’s imagination going.
He began to try to construct different phrases with palindromes, to see
if he could put different words together to make a palindrome. Jake came up with a list of these phrases,
but is not sure if they are all really palindromes. It is your job to determine if Jake’s phrases
are really palindromes.
Input:
Input will consist of a list of phrases. Each phrase will be on a separate line, with
a zero on the last line signifying the end of input. The phrases can contain punctuation (such as
quotations, commas, periods, etc…).
Punctuation should be removed from the phrase, as it is not considered
part of the palindromic property we are considering
for this problem. Phrases should not be
case-sensitive either, so that capital letters should be considered no
different from their lower-case equivalent.
Output:
Output will contain the phrase as it was entered
from input, then either “is a palindrome”, or “is not a palindrome” following
it on the same line. There should not
be a blank line at the end of the input.