HackerRank Java Stdin and Stdout II problem solution - TheCScience