Google Sheets, 279 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;ifs(w(s),s,w(c),c,1,)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
ifs(w(s), s, w(c), c, 1, )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: While this will give the correct result for all test cases presented in the question, it won't handle a triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings so "lama", "aardvark" does get the correct result. Note also that regex special characters are not escaped.)
Google Sheets, 279 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;ifs(w(s),s,w(c),c,1,)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
ifs(w(s), s, w(c), c, 1, )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: While this will give the correct result for all test cases presented in the question, it won't handle a triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings so "lama", "aardvark" does get the correct result.)
Google Sheets, 279 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;ifs(w(s),s,w(c),c,1,)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
ifs(w(s), s, w(c), c, 1, )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: While this will give the correct result for all test cases presented in the question, it won't handle a triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings so "lama", "aardvark" does get the correct result. Note also that regex special characters are not escaped.)
Google Sheets, 280279 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;if(w(c),ifa;ifs(w(s),s,w(c),c,1,)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
ififs(w(cs), if(s, w(sc), sc, c)1, )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: ThisWhile this will give the correct result for all test cases presented in the question, it won't handle a triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings so "lama", "aardvark" getsdoes get the correct result.)
Google Sheets, 280 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;if(w(c),if(w(s),s,c),)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
if(w(c), if(w(s), s, c), )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: This won't handle a triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings so "lama", "aardvark" gets the correct result.)
Google Sheets, 279 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;ifs(w(s),s,w(c),c,1,)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
ifs(w(s), s, w(c), c, 1, )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: While this will give the correct result for all test cases presented in the question, it won't handle a triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings so "lama", "aardvark" does get the correct result.)
Google Sheets, 281280 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A2A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;if(w(c),if(w(s),s,c),)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A2A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
if(w(c), if(w(s), s, c), )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: I don't think this willThis won't handle triplesa triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings. The question only mentions duplicates, so.. "lama", "aardvark" gets the correct result.)
Google Sheets, 281 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A2:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;if(w(c),if(w(s),s,c),)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A2:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
if(w(c), if(w(s), s, c), )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: I don't think this will handle triples in A1 correctly. Triples and above are fine in the rest of strings. The question only mentions duplicates, so...)
Google Sheets, 280 bytes
=let(f,lambda(t,split(regexreplace(t,"\B|\b","→"),"→")),g,lambda(t,join(,sort(tocol(f(t))))),v,map(tocol(A:A,1),g),w,lambda(m,rows(v)=counta(ifna(filter(v,regexmatch(v,m))))),f(join(,unique(reduce(,f(A1),lambda(a,c,let(s,regexextract(g(A1),c&"+"),{a;if(w(c),if(w(s),s,c),)})))))))
Put the strings in cells A1:A and the formula in cell B1.
screenshot
Ungolfed:
=let(
f, lambda(t, split(regexreplace(t, "\B|\b", "→"), "→")),
g, lambda(t, join(, sort(tocol(f(t))))),
v, map(tocol(A:A, 1), g),
w, lambda(m, counta(v) = counta(ifna(filter(v, regexmatch(v, m))))),
r, reduce(, f(A1), lambda(a, c, let(
s, regexextract(g(A1), c & "+"),
vstack(
a,
if(w(c), if(w(s), s, c), )
)
))),
f(join(, unique(r)))
)
The formula sorts characters within strings and finds repeated characters in A1 in the other strings, falling back to finding non-repeated characters in A1. When the number of matches is the same as the total number of strings, the repeated characters are included in the result (or ditto for a non-repeated character.) Finally, get uniques, possibly including repeated characters.
(Note: This won't handle a triple like "aardvark" in A1 correctly when there are doubles like "lama" in other strings. Triples and above are fine in the rest of strings so "lama", "aardvark" gets the correct result.)