Add solution to problem 002 in ruby