Solution for Valid Palindrom.