PS you can do:

Hash.new(0)

and it will create an empty hash where default values are 0 (so the below "+= 1" code will work).