Function to display the resultamt stack
static void display ( Stack < int > res ) { int N = res . Count ; String s = " " ; while ( res . Count != 0 ) { s = String . Join ( " " , res . Peek ( ) ) + s ; res . Pop ( ) ; } Console . Write ( s + " STRNEWLINE " ) ; }