Write a program that reads words from stdin and prints to stdout those words which are palindromes.
A good source of words to give your program as input is the file
/usr/share/dict/words
. e.g.:
% ./palindrome </usr/share/dict/words
You may find some or all of the following functions and concepts useful:
fgets
(notice that it includes the \n
character)tolower
char*
(pointers to characters in strings)\0
printf
while
Include a README file which discusses the approach and limitations of the program that you wrote.