function [words,cnts] = countWords(wordlist)
nmax = floor(1.5.*length(wordlist(:))); %! nmax must be bigger for efficiency
h = makeHashTable(nmax);
counts = zeros(nmax,1); %! initialize counts
for k=1:length(wordlist(:))
    ind = insertInHashTable(wordlist{k}); %! slot for this word
    counts(ind) = counts(ind) + 1; %! update count in that slot
end
[words,inds] = reportHashTable; %! get rid of blanks
cnts = counts(inds); 