A word counter for String and Hash in Ruby