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 40 41 42 43 44 45 46 47 48 49
| import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); char[] c = S.toCharArray(); StringBuilder sb = new StringBuilder(); double a = Math.pow(10, 6);
for (int i = 0; i < c.length; i++) { char str = c[i];
if (str >= 65 && str <= 90 || str >= 97 && str <= 122) { for (int i1 = c.length - 1; i1 >= 0; i1--) { char str2 = c[i1]; sb.append(str2); } String str3 = sb.toString();
if (str3.equals(S)) { System.out.println("Y"); } else { System.out.println("N"); } break;
} else { System.out.println("N"); break; }
} } scan.close(); } }
|