Unique characters: Difference between revisions

Line 945:
unpack = unpack or table.unpack -- compatibility for all Lua versions
 
local map = {}
for i, str in ipairs (strings) do
local map = {}
for i=1, string.len(str) do
local char = string.sub(str,i,i)
Line 955 ⟶ 956:
end
end
local list = {}
end
for char, bool in pairs (map) do
 
if bool then
table.insertlocal (list, char)= {}
for char, bool in pairs (map) do
end
if bool then
table.sortinsert (list, char)
end
end
table.sort (list)
print (unpacktable.sort (list))
endprint (unpack (list))</lang>
{{out}}<pre>1 5 6 b g s t z</pre>
1 5 a b c
6 a s t
d f g z</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
Anonymous user