first version
groovy version
1st version and final solution