C # program to implement the above approach
using System ; class GFG { static string rev ( string str ) { int st = 0 ; int ed = str . Length - 1 ; char [ ] s = str . ToCharArray ( ) ; while ( st < ed ) { char temp = s [ st ] ; s [ st ] = s [ ed ] ; s [ ed ] = temp ; st ++ ; ed -- ; } return new string ( s ) ; } static bool check ( string a , string b , int n ) { int i = 0 ; int j = n - 1 ;