Hi,

Didn't have much time for this, so here's a partial solution.
What I haven't done is work on ARGV and the bracket removal code is  
pretty basic
produces
1+(56+35)/(16-9) - good
1+(2+(3+4)) - needs work...

Cheers,
Dave


eqn= %w[1 56 35 + 16 9 - / +]
ops= %w[+ - * /]

stack= []

eqn.each do |e|
   if ops.include? e
     b= stack.pop || 0
     a= stack.pop || 0
     if stack.empty?
       stack= [a, e.to_sym, b]
     else
       stack << [a, e.to_sym, b]
     end
   else
     stack << e
   end
end

def disp item, depth
   str=''
   if item.class== Array
     inner= item.inject('') {|sum, e| sum << (disp e, depth+1)}
     inner= "(#{inner})" unless ([:*, :/].include? item[1]) || depth==0
     str << inner
   else
     str << item.to_s
   end
   str
end

puts disp(stack,0)