A few solutions in ruby