524 B
524 B
parents | |
---|---|
|
public static String test(String s) {
if (s.length() == 1) {
return "YES";
} else {
if (s.substring(0, 1).equals(s.substring(s.length() - 1, s.length()))) {
if (s.length() == 2) {
return "YES";
}
return test(s.substring(1, s.length() - 1));
} else {
return "NO";
}
}
}