Solve problem 46 using C++, Go, and Python.