java program that checks if a word is palindrome