first solution to ruby-1 challenge 4