import java.util.function.*;

class Ideone {
	static Predicate<String> isPalindrome = 
	  s->s.matches("|(?:(.)(?<=(?=^.*?(\\1\\2?)$).*))+(?<=(?=^\\2$).*)")//)")*.)$2\\^=?(=<?(+))*.)$)?2\\1\\(?*.^=?(=<?().(:?(|"(sehctam.s>-s
	  ;
	
	public static void main (String[] args) throws java.lang.Exception {
		testPalindrome("", true);
		testPalindrome("x", true);
		testPalindrome("xx", true);
		testPalindrome("xy", false);
		testPalindrome("xyx", true);
		testPalindrome("xxx", true);
		testPalindrome("xxyx", false);
		testPalindrome("racecar", true);
		testPalindrome("step on no pets", true);
		testPalindrome("aManaPlanaCanalPanaMa", true);
		testPalindrome("this is impossible", false);
	}
	
	static void testPalindrome(String s, boolean expected) {
		if (isPalindrome.test(s) == expected) {
			System.out.println("OK");
		} else {
			System.out.printf("NOK: str=\"%s\", expected=%b%n", s, expected);
		}
	}
}