solved problem_2.rb