11673 - 231001_11/16_practice9-1   

Description

 

  •  A palindrome a word such as “deed” or “level”, which is the same when you spell it backwards.
  • Write a program that inputs a word (a sequence of lowercase letters) and determines whether or not the word is a palindrome. Each input word has at least 1 and at most 20 letters.
  • Use “\0” to find the length.
  • You should deal with user input and palindrome detection in two separate functions instead of in main() as follows:
  1. int input(char s[]); /* input a word in s[] and return the length of the word */
  2. int is_palindrome(char *s, int n); /* check if s[] is a palindrome where n is the length of the word */
  • Your main function should do nothing more than declaring the array and calling the above mentioned two functions.
  • You should not handle any input or palindrome detection in your main function.

Input

A word

Output

 

  • Output: Detect it is palindrome or not
  • Output format:  
  1. See the sample output
  2. Change a new line at the end

Sample Input  Download

Sample Output  Download

Tags




Discuss