Added groovy solution for #1.