HackerRank C++ Class Templates problem solution - TheCScience