Unique characters
Unique characters is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
Given a list of strings find characters appearing only one string and once only.
The result give in alphabetical order.
Let list = ["133252abcdeeffd", "a6789798st","yxcdfgxcyz"]
Factor
<lang factor>USING: io sequences sets.extras sorting ;
{ "133252abcdeeffd" "a6789798st" "yxcdfgxcyz" } concat non-repeating natural-sort print</lang>
- Output:
156bgstz
Ring
<lang ring> see "working..." + nl see "Unique characters are:" + nl row = 0 str = "" cList = [] uniqueChars = ["133252abcdeeffd", "a6789798st","yxcdfgxcyz"] for n = 1 to len(uniqueChars)
str = str + uniqueChars[n]
next for n = 1 to len(str)
ind = count(str,str[n]) if ind = 1 row = row + 1 add(cList,str[n]) ok
next cList = sort(cList) for n = 1 to len(cList)
see "" + cList[n] + " "
next see nl
see "Found " + row + " unique characters" + nl see "done..." + nl
func count(cString,dString)
sum = 0 while substr(cString,dString) > 0 sum++ cString = substr(cString,substr(cString,dString)+len(string(sum))) end return sum
</lang>
- Output:
working... Unique characters are: 1 5 6 b g s t z Found 8 unique characters done...