Sets
const longest = (s1, s2) => [...new Set(s1 + s2)].sort().join('') ///Create a function that accepts two strings s1 and s2, that returns a new string that is sorted and as long as possible, only using unique letters from s1 and s2.
a = "xyaabbbccccdefww"
b = "xxxxyyyyabklmopq"
longest(a, b)
This Gist was automatically created by Carbide, a free online programming environment.