returns two array, keys of words and values of times appeared