local fmt = require "fmt" local word_list = "unixdict.txt" -- local copy local nl = os.platform == "windows" ? "\r\n" : "\n" local words = io.contents(word_list):rstrip():split(nl):map(|w| -> w:strip()) local word_map = {} for words as word do local letters = word:split("") letters:sort() local sorted_word = letters:concat("") if word_map[sorted_word] then word_map[sorted_word]:insert(word) else word_map[sorted_word] = {word} end end local most = word_map:values():reduce(|max, v| -> #v > max ? #v : max, 0) for key, val in word_map do if #word_map[key] == most then fmt.lprint(val) end end