Solution to Ruby-0 challenge 6