count word frequency in string or array, return as key/val pairs