An interesting programming problem.