solved problem 33 again in ruby