Solve problem 62 using Ruby.