Decided to solve in Ruby