solved problem 36 again in ruby