Wikipedia defines Palindrome as, “A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction (the adjustment of punctuation and spaces between words is generally permitted).”
There are two different kinds of Palindrome. One is on a character by character basis while the other is on a word by word basis. Examples of these two type of palindromes are “Was it a rat I saw?” and “Fall leaves after leaves fall” respectively.
I have written a program in C++ which can check a word, phrase or sentence if it is a palindrome on a character by character basis. It is capable of handling complex sentences with punctuation marks such as “Dammit, I’m mad!”.
The logic I used in this program is almost self evident but still I have written a short explanation of how it works in the following lines. Continue reading C++ program to check if a sentence is a Palindrome or not