-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumber_Beautiful.java
More file actions
29 lines (29 loc) · 899 Bytes
/
Number_Beautiful.java
File metadata and controls
29 lines (29 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.*;
public class Number_Beautiful {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
while(T-->0){
String s = in.next();
int n = s.length();
// System.out.println(n);
boolean check1 = true, check2 = true;
for(int i=0;i<n;i++){
if(Character.getNumericValue(s.charAt(i)) % 2 != 0){
check1 = false;
break;
}
}
for(int i=0;i<=n/2;i++){
if(s.charAt(i) != s.charAt(n-i-1)){
check2 = false;
break;
}
}
if(check1 == true && check2 == true)
System.out.println("YES");
else
System.out.println("NO");
}
}
}