[java]代码库
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int d = scan.nextInt();
String s = String.valueOf(d);
int n = s.length();
String s1 = "";
int i, j, flag = 0;
for(i = 0, j = n-1; i <n&&j >= 0; i++, j--) {
s1 += s.charAt(j);
}
System.out.println(n);
if(s.equals(s1)) {
System.out.println("Y");
}
else
System.out.println("N");
scan.close();
}
}
2:
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
String s = String.valueOf(N);
String s1;
StringBuffer sb = new StringBuffer(s);
s1 = new String(sb.reverse().toString());
System.out.println(s.length());
if(s.equals(s1))
System.out.println("Y");
else
System.out.println("N");
scan.close();
}
}