A palindrome is a word or phrase that has the property of being read from right to left or from left to right. For example, strings "aaaaa"
, "1221"
, "bbaabb"
are palindromes, however the string "chef"
is not a palindrome.
For cases where a sentence is given, spaces and case differences are ignored. For example, the phrase "A base do teto desaba"
is considered a palindrome. When you read it from right to left, you get: "abased otet od esab A"
. Notice that, with the exception of space, the string is the same as the original phrase.
How to write a program that indicates whether a given string is a palindrome or not using strings knowledge?