This is one of solution to this problem.
a=[];$<.map{|l|l=='0'?($><<a.pop):a<<l}
I run it on a terminal but it displays no output.
Where has $>
which is $DEFAULT_OUTPUT gone?
I used p $>
etc but it does not output the result.
How can I display the result of $>
on a terminal?