solved problem 73 in ruby