← Coding round practice

Palindrome String

EasyStrings

The problem

Check whether a given string is a palindrome — it reads the same forwards and backwards.

Sample input

madam

Sample output

true
Show the solution · 8 languages
fun isPalindrome(s: String) = s == s.reversed()

fun main() {
    println(isPalindrome("madam"))
}