-- q contains all the letters from s?
function containedIn(s,q)
local r
for i=1,#s do
q,r=string.gsub(q,string.sub(s,i,i),"",1)
if r==0 then return false end
end
return true
end
function cubeWords(q)
q5=string.sub(q,5,5)
for l in io.lines("words.txt") do
l=string.lower(l)
if #l>3 and string.find(l,q5) and containedIn(l,q) then
print(l)
end
end
end
cubeWords("ncbcioune")