HackerRank Strings in C++ problem solution - TheCScience