-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ03021.java
More file actions
26 lines (23 loc) · 844 Bytes
/
J03021.java
File metadata and controls
26 lines (23 loc) · 844 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
package CODE_PTIT;
import java.util.Scanner;
public class J03021 {
public static void main(String[] args) {
Scanner inp = new Scanner((System.in));
int t = Integer.parseInt(inp.nextLine());
int a[] = {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9};
while (t-- > 0) {
String s = inp.nextLine().toLowerCase();
String tmp = "";
for (int i = 0; i < s.length(); i++) {
String s1 = Integer.toString(a[s.charAt(i) - 'a']);
tmp = tmp + s1;
}
if (tmp.compareTo(new StringBuilder(tmp).reverse().toString()) == 0) {
System.out.println("YES");
}
else {
System.out.println("NO");
}
}
}
}