
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward.
Given a string A, print Yes
if it is a palindrome, print No
otherwise.
Constraints
- A will consist at most 50 lower case english letters.
Sample Input
madam
Sample Output
Yes
Code Solution:
//Java String Reverse Hackerrank Solution import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String A=sc.next(); /* Enter your code here. Print output to STDOUT. */ System.out.println( A.equals( new StringBuilder(A).reverse().toString()) ? "Yes" : "No" ); } } //Java String Reverse Hackerrank Solution
Disclaimer: This problem is originally created and published by HackerRank, we only provide solutions to this problem. Hence, doesn’t guarantee the truthfulness of the problem. This is only for information purposes.