HackerRank Messages Order in C++ problem solution - TheCScience