Word frequency count FIXED by murky-satyr

d={}for w in io.read'*a':lower():gsub('[^ %a]',''):gfind'%S+'do d[w]=1+(d[w]or 0)end
a={}for k in next,d do a[#a+1]=k end
table.sort(a)for i=1,#a do print(d[a[i]]..' '..a[i])end

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page