prob_22 ruby solve