problem 1 done in ruby
second problem done in ruby