fork(1) download
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. class TestClass {
  5. public static void main(String args[] ) throws Exception {
  6.  
  7. Scanner s=new Scanner(System.in);
  8. int t=s.nextInt();
  9. while(t-->0){
  10. String k=s.next();
  11. int c=0;
  12.  
  13. StringBuffer w=p.reverse();
  14.  
  15. if(p.toString().equals(p.reverse().toString())){
  16. //System.out.print(p.equals(w));
  17.  
  18. for(int i=0;i<p.length();i++)
  19. {
  20. if(p.charAt(i)=='1'||p.charAt(i)=='0'||p.charAt(i)=='8') { c++;}
  21. }
  22. }
  23. if(c==p.length())System.out.println("YES");
  24. else System.out.println("NO");
  25.  
  26. }
  27.  
  28. }
  29. }
  30.  
Success #stdin #stdout 0.1s 380736KB
stdin
4
101
020
1811
1888
stdout
YES
NO
NO
NO