Challenge 3: Check Palindrome

Given a string, check whether or not it is a palindrome.

Problem Statement

Write a function that takes a variable testVariable, which contains a string, and checks whether or not it is a palindrome.

What is a “Palindrome”?

A Palindrome is a string that reads the same backward and forwards. For example madammadam, poppop, etc. All strings with length 11 are considered palindromes.

Remember, lower case letters are different from upper case letters, therefore, AdaAda is not a palindrome.

Input

A variable testVariable containing a string.

Output

true if the input string is a palindrome. false if the string is not a palindrome.

Sample Input

"madam"

Sample Output

true

Try it Yourself

Try this challenge yourself before examining the solution. Good luck!

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.