Given a string , print Yes if it is a palindrome, print No otherwise.

Constraints

  •  will consist at most  lower case english letters.


hackerrank java string reverse solution



Java String Reverse problem solution | HackerRank

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 R = new StringBuilder(A).reverse().toString();
        
        if(A.equals(R)) System.out.println("Yes");
        else System.out.println("No");
    }
}