C++ solution to KataPotter