Function to display the resultamt stack
function display ( res ) { var N = res . length ; var s = " " ; while ( res . length != 0 ) { s = ( res [ res . length - 1 ] . toString ( ) ) + s ; res . pop ( ) ; } document . write ( s ) ; }