palindrome in cpp using while