Function to check if a string S is a palindrome
static bool palindrome ( string str ) { int st = 0 ; int ed = str . Length - 1 ; while ( st < ed ) { if ( str [ st ] == str [ ed ] ) { st ++ ; ed -- ; } else return false ; } return true ; }