Solved 9 in ruby

Solved 9