A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as madam or racecar. Sentence-length palindromes may be written when allowances are made for adjustments to capital letters, punctuation, and word dividers, such as “A man, a plan, a canal, Panama!”, “Was it a car or a cat I saw?” or “No ‘x’ in Nixon”.
Composing literature in palindromes is an example of constrained writing.
The word “palindrome” was coined by the English playwright Ben Jonson in the 17th century from the Greek roots palin (π¿λιν; “again”) and dromos (δρóμος; “way, direction”).
So how do we put it in code?
Well lets take an example.
Lets say we have the string racecar , how do we write a script to check if this string is a palindrome.