Solved #142 in Groovy