What is a palindrome string?
A palindrome string is the string that is equal to its reverse string i.e. if the string read from left to right is equal to string reads from right to left is called a palindrome string.
For example: "radar" is a palindrome string.
Given a string, we have to check whether string is palindrome string or not.
Example:
Input:
string = "radar"
Output:
"radar" is a palindrome string.
Input:
string = "hello"
Output:
"hello" is not a palindrome string.
Program to check palindrome string in Kotlin
In the below program, at the first we are reading a string and then reversing the string, finally comparing the original string with the reverse string. If both are equal then the string will be a palindrome string.
Output
need an explanation for this answer? contact us directly to get an explanation for this answer