count words from a text of file input and return nb of occurences of each word