10 lines
359 B
Text
10 lines
359 B
Text
local function quibbling(w)
|
|
local c = #w
|
|
if c == 0 then return "{}" end
|
|
if c == 1 then return $"\{{w[1]}}" end
|
|
if c == 2 then return $"\{{w[1]} and {w[2]}}" end
|
|
return $"\{{w:slice(1, #w - 1):concat(", ")} and {w[#w]}}"
|
|
end
|
|
|
|
local words = { {}, {"ABC"}, {"ABC", "DEF"}, {"ABC", "DEF", "G", "H"} }
|
|
for words as w do print(quibbling(w)) end
|