added ruby version of problem 1