package huiwen;
import java.util.Scanner;
public class Huiwen {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s;
int j;
int i = 0;
Scanner input = new Scanner(System.in);
System.out.println("请输入 一个字符串:");
s = input.next();
char a[];
a = s.toCharArray();
j = a.length - 1;
for (int k = 0; k < s.length(); k++) {
System.out.print(a[k]);
}
huiwen(a, j, i);
} public static void huiwen(char a[], int j, int i) {
if (i >= j) {
if (a[i] == a[j]) System.out.println("是回文");
System.exit(0);
}
if (a[i] == a[j])
huiwen(a, --j, ++i);
else {
System.out.println("不是回文!");
System.exit(0);
}
}
}