- import java.util.*;
- class TestDemo
- {
- public static void main(String[] args)
- {
- Scanner sc = new Scanner(System.in);
- String s = sc.nextLine();
- int len = s.length();
- String s1 = s.substring(0,len/2);
- String s2 = s.substring(len/2+(len%2==1?1:0),len);
- if(s1.equals(new String(new StringBuilder(s2).reverse())))
- System.out.println("对称");
- else
- System.out.println("不对称");
- }
- }
复制代码 |