prob_12 Ruby solve