HackerEarth Beautiful numbers problem solution - TheCScience