solved problem 80 in ruby