Solved ValidPalindrome in java