13011 - Palindrome Detection (hard version)   

Description

  • A palindrome is a word like “deed” or “level”, which remains the same when you spell it backward.

  • Write a program that inputs a word that terminates with a period '.' and determines whether or not the word is a palindrome.

  • Each input word's length is at least 1 and there is no maximum limit for its length. You must use DYNAMIC ARRAYs to do this task.

  • (Hint: You may define an array of size 20 to take the input first. If it's not enough, double its size to allow more input.)

Input

String of characters that terminates with a period '.'

Output

"a palindrome\n" or "not a palindrome\n"

Sample Input  Download

Sample Output  Download

Tags




Discuss