Exercise · Strings · lesson 12 of 12
Exercise: palindrome
Write a function function isPalindrome(s) that returns true if s reads the same left to right and right to left, and false otherwise. Capital and small letters count as the same, and spaces are ignored.
isPalindrome("level")→trueisPalindrome("Never odd or even")→trueisPalindrome("hello")→false
Constraints: s has 0 to 100 characters — Latin and Russian letters and spaces; the string may start and end with spaces. The empty string and a string of spaces only are palindromes.
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.