Sort the letters of string in alphabetical order: Difference between revisions
Sort the letters of string in alphabetical order (view source)
Revision as of 03:01, 12 January 2022
, 2 years agoAdded 11l
Not a robot (talk | contribs) (Add CLU) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 14:
Write the function even if your language has a built-in function for it.
<br><br>
=={{header|11l}}==
<lang 11l>F sorted_str(s)
DefaultDict[Char, Int] d
L(c) s
d[c]++
V r = ‘’
L(k) sorted(d.keys())
r ‘’= k * d[k]
R r
print(sorted_str(‘The quick brown fox jumps over the lazy dog, apparently’))
print(sorted_str(‘Is this misspelling of alphabetical as alphabitical a joke ?’))</lang>
{{out}}
<pre>
,Taaabcdeeeefghhijkllmnnoooopppqrrrsttuuvwxyyz
?Iaaaaaaaabbcceeefghhhiiiiiijkllllllmnoopppsssssttt
</pre>
=={{header|Action!}}==
|