Port 1 easy to C++, and shell for the new moderate problem.