- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String str = sc.nextLine().trim();
- sc.close();
- int n = str.length();
- for (int i = 0; i < n / 2; i++) {
- if (str.charAt(i) != str.charAt(n - 1 - i)) {
- System.out.println("flase");
- return;
- }
- }
- System.out.println("true");
- }
复制代码 |