problem 4: term frequency