HackerRank Java Visitor Pattern problem solution - TheCScience