Solved https://www.codeeval.com/open_challenges/119/, modified base
Main.java