11673 - 231001_11/16_practice9-1
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
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:
- int input(char s[]); /* input a word in s[] and return the length of the word */
- 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:
- See the sample output
- Change a new line at the end
Tags