回文字符串

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();
	}

}

 

posted @ 2017-06-24 22:08  eros_token  阅读(172)  评论(0编辑  收藏  举报