import java.util.Scanner;
/**
* 给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的
* @author kif
*
*/
public class Palindrome {
public static void judge(String str){
String sOne = str.substring(0, str.length()/2);
System.out.println(sOne.startsWith(new StringBuffer(str).reverse().substring(0, str.length()/2)));
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
String str = input.nextLine();
Palindrome.judge(str);
input.close();
}
}
原文:http://www.cnblogs.com/kongkongFabian/p/7074626.html