finished problem 8 in ruby