Assignment

A string is a palindrome if it reads the same forward and backward. The words “mom,” “dad,” and “noon,” for instance, are all palindromes. The problem is to write a program that prompts the user to enter a string and reports whether the string is a palindrome. One solution is to check whether the first character in the string is the same as the last character. If so, check whether the second character is the same as the second-to-last character. This process continues until a mismatch is found or all the characters in the string are checked, except for the middle character if the string has an odd number of characters.

Specifications

Example 1

Below is an example execution of the task. The text in red represents user input and logically is not printed by your program.

Enter a string: 
 Hannah
The string Hannah is a palindrome.

Example 2

enter string:
 ugent
The string ugent is not a palindrome.