s=$>.sync="" loop{s=(?0..?9).max_by{|c|puts (c+s).rjust 10,?0 gets[9]?exit: $_}+s}