Perfect reversible string | C # program to check if a string is perfect reversible or nor ; This function basically checks if string is palindrome or not ; iterate from left and right ; Driver Code
using System ; class GFG { public static bool isReversible ( string str ) { int i = 0 , j = str . Length - 1 ; while ( i < j ) { if ( str [ i ] != str [ j ] ) { return false ; } i ++ ; j -- ; } return true ; } public static void Main ( string [ ] args ) { string str = " aba " ; if ( isReversible ( str ) ) { Console . Write ( " YES " ) ; } else { Console . Write ( " NO " ) ; } } }