C++ solutions are added.