cpp implementation of Valid Prlindrome