solved problem 40 again in ruby