Your code quite effectively forms a union of the two strings' characters. However, the OP's request was to 1) compare two strings, and 2) return only the unique values. Where does your code compare the two strings? Forming a union of their characters does not compare the two strings. In fact, if we strictly regard their union as a non-multiset of characters, "a" is unique, since (set notation): {a} = {a,a} = {a,a,a}. Thus, "a" should still appear in their union--even with two occurrences within one string.
As has been point out, the OP's specs are equivocal, yet I tend to favor "unique" as meaning a character (replicated or not) that only belongs to one or the other string (i.e., "unique to")--and is not in both.
In reply to Re^4: compare two strings and return only he unique values.
by Kenosis
in thread compare two strings and return only he unique values.
by Learnlot1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |