-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ03006.java
More file actions
39 lines (36 loc) · 943 Bytes
/
J03006.java
File metadata and controls
39 lines (36 loc) · 943 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
30
31
32
33
34
35
36
37
38
39
package CODE_PTIT;
import java.util.*;
/**
*
* @author Acer
*/
public class J03006 {
public static int ThuanNghich(String s){
int l = 0, r = s.length()-1;
while(l < r){
if(s.charAt(l) != s.charAt(r)) return 0;
l++; r--;
}
return 1;
}
public static int EvenNum(String s){
for(int i = 0; i < s.length();i++){
if((s.charAt(i) - '0') % 2 != 0 ) return 0;
}
return 1;
}
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
int t;
t = Integer.parseInt(inp.nextLine());
while(t-- > 0){
String s = inp.nextLine();
if(ThuanNghich(s) == 1 && EvenNum(s) == 1){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}