Unique characters: Difference between revisions
Content added Content deleted
Line 945: | Line 945: | ||
unpack = unpack or table.unpack -- compatibility for all Lua versions |
unpack = unpack or table.unpack -- compatibility for all Lua versions |
||
⚫ | |||
for i, str in ipairs (strings) do |
for i, str in ipairs (strings) do |
||
⚫ | |||
for i=1, string.len(str) do |
for i=1, string.len(str) do |
||
local char = string.sub(str,i,i) |
local char = string.sub(str,i,i) |
||
Line 955: | Line 956: | ||
end |
end |
||
end |
end |
||
local list = {} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
local list = {} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
end |
|||
⚫ | |||
table.sort (list) |
|||
print (unpack (list))</lang> |
|||
{{out}}<pre> |
{{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}}== |
=={{header|Mathematica}}/{{header|Wolfram Language}}== |