Reverse the substring starting after the last encountered opening bracket till the current character
else if ( str . charAt ( i ) == ' ) ' ) { char [ ] A = str . toCharArray ( ) ; reverse ( A , st . peek ( ) + 1 , i ) ; str = String . copyValueOf ( A ) ; st . pop ( ) ; } }