Using the more elegant each_with_object instead of each

A tiny change, but this way the accumulator does not need to be declared and initialized separate from the code block that populates it.