22.06.19 11:20 작성
·
217
0
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num = scanner.nextInt();
String [] arrStr = new String[num];
for(int i =0;i<num;i++){
arrStr[i] = scanner.next();
}
for(String s : arrStr){
int ans = check(reverse(s));
if(ans != 0){
System.out.print(ans + " ");
}
}
}
public static int reverse(String str){
str=new StringBuilder(str).reverse().toString();
return Integer.valueOf(str);
}
public static int check(int num){
if(num == 1) return 0;
for (int i=2;i<num/2;i++){
if(num%i == 0){
return 0;
}
}
return num;
}
}