A utility function to reverse an array from index 0 to n - 1
void reverse ( char arr [ ] , int n ) { int l = 0 , r = n - 1 ; while ( l < r ) { int temp = arr [ l ] ; arr [ l ] = arr [ r ] ; arr [ r ] = temp ; l ++ ; r -- ; } }