solved problem 11 again in ruby