simplify exercise5.rb