Write a function that takes a string as a parameter and returns True if the string is a palindrome, False otherwise. Remember that a string is a palindrome if it is spelled the same both forward and backward. for example: ‘radar’ is a palindrome.
To make it more interesting, you will also consider that palindromes can also be phrases, but you need to remove the spaces and punctuation before checking. for example: “madam i’m adam” is a palindrome.
Other fun palindromes include:
• Live not on evil
• Reviled did I live, said I, as evil I did deliver • Go hang a salami; I’m a lasagna hog.
• Able was I ere I saw Elba
• Kanakanak – a town in Alaska
• Wassamassaw – a town in South Dakota
First line of input contains a positive integer T (T ≤ 100), where T denotes the number of test cases. This line is followed by T more lines, where each line contains a string S.
For each line of input, there will be one line of output – “yes” if the input is a palindrome; “no” otherwise.
8 aibohphobia Live not on evil
Root the toor
Reviled did I live, said I, as evil I did deliver Go hang a salami; I’m a lasagna hog
Able was I ere I saw Elba