finished prob_2, ruby version