Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Solution {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int t = sc.nextInt();
- StringBuilder ans = new StringBuilder("");
- while (t-- > 0) {
- char[] arr= sc.next().toCharArray();
- int i=0,j=arr.length-1;
- boolean z = true;
- while(i<=j){
- if(arr[i]!=arr[j]){
- z=false;
- break;
- }
- i++;
- j--;
- }
- if(z){
- ans.append("YES\n");
- }else{
- ans.append("NO\n");
- }
- }
- System.out.println(ans);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment