解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.next(); char str[] = s.toCharArray(); int ans = 0; for(int i = 0, j = str.length - 1; i != j && j > i; i ++, j --) { if(str[i] != str[j]) { System.out.println("NO"); ans = 1; } } if(ans == 0) { System.out.println("YES"); } } }
0.0分
0 人评分