HackerEarth Beautiful Strings problem solution - TheCScience