Anonymous user
Unique characters: Difference between revisions
→{{header|Lua}}
Line 949:
for i=1, string.len(str) do
local char = string.sub(str,i,i)
if map[char] ==
map[char] = true
else
map[char] = false
end
end
local list = {}
for char, bool in pairs (map) do
if bool then
table.insert (list, char)
end
end
table.sort (list)
print (unpack (list))
end</lang>
{{out}}<pre>1 5 a b c▼
▲{{out}}<pre>
d f g z</pre>▼
▲6 7 8 9 a s t
▲</pre>
=={{header|Mathematica}}/{{header|Wolfram Language}}==
|