A palindrome is a word, phrase, number, or other sequences 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 of at most lower case English letters.
Sample Input
madam
Sample Output
Yes
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();
String reverse="";
int length = A.length();
for(int i =length-1;i>=0;i--){
reverse = reverse+A.charAt(i);
}
if(reverse.equals(A)){
System.out.println("Yes");
}
else{
System.out.println("No");
}
/* Enter your code here. Print output to STDOUT. */
}
}