Unique characters: Difference between revisions

m
Line 866:
The simple approach here is to merge the argument strings and find characters which occur exactly once in that intermediate result:
<lang J>uniques=: ~.#~1=#/.~</lang>
In other words, <code>~.</code> finds the distinct characters, <code>#/.~</code> finds the corresponding counts of those characters, so <code>1=#/.~</code> is true for the characters which occur exactly once, and <code>#~</code> filters the distinct characters based on that truth value.
{{out}}
<pre> uniques;'133252abcdeeffd';'a6789798st';'yxcdfgxcyz'
6,962

edits