(golang) Problem 9 solution