Letter Set Difference
Problem statement
Return a string containing each distinct character that appears in exactly one of first and second, sorted by ascending character code.
Function
letterSetDifference(first: String, second: String) → StringExamples
Example 1
first = "apple"second = "pear"return = "lr"l occurs only in apple and r only in pear; a, p, and e occur in both.
Constraints
- Each string contains at most
10^5ASCII characters.