Reverse the substring starting after the last encountered opening bracket till the current character
else if ( str [ i ] == ' ) ' ) { reverse ( str . begin ( ) + st . top ( ) + 1 , str . begin ( ) + i ) ; st . pop ( ) ; } }