Solution for Valid Palindrome