Solution for codeeval