HackerRank Java Instanceof keyword problem solution - TheCScience