Pally's favourite word is saippuakivikauppias
which is Finnish for a dealer in lye (caustic soda). It's the longest known palindromic word!
A palindrome is a word where the letters read backwards, give the same word. Another example is the word racecar
.
Help Pally out by writing a program that which reads a string and tests if it is a palindrome.
Given racecar\n
as input, it should print String is a palindrome
. Otherwise if it is not a palindrome, it should print String is not a palindrome
.
The output from your program should look exactly like this:
$ dcc pallys_palindromes.c -o pallys_palindromes
$ ./pallys_palindromes
racecar
String is a palindrome
Do not use scanf - use fgets to read the string.
You can assume lines contain at most 4096
characters.
Checking the palindrome should be case insensitive, i.e. a
should be treated as the same letter as A
.
When you think your program is working, you can use CSE autotest to test your solution.
$ 1511 csesoc-autotest pallys_palindromes
You can view the solution code to this problem here.