Function to check palindrome
static bool isPalindrome ( string s ) { int left = 0 , right = s . Length - 1 ; while ( left <= right ) { if ( s [ left ] != s [ right ] ) { return false ; } left ++ ; right -- ; } return true ; }