first solution to Ruby-1 ex2