Checking palindrome for first half of the string with the rest, this case assumes removal of any white spaces.
public int isPalindrome(String a) {
//Remove all spaces and non alpha characters
String ab = a.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
//System.out.println(ab);
for (int i=0; i