When we add a letter Y to our candidate longest uncommon subsequence answer of X, it only makes it strictly harder to find a common subsequence. Thus our candidate longest uncommon subsequences will be chosen from the group of words itself.

Suppose we have some candidate X. We only need to check whether X is not a subsequence of any of the other words Y. To save some time, we could have quickly ruled out Y when len(Y) < len(X), either by adding "if len(w1) > len(w2): return False" or enumerating over A[:i] (and checking neighbors for equality.) However, the problem has such small input constraints that this is not required.

We want the max length of all candidates with the desired property, so we check candidates in descending order of length. When we find a suitable one, we know it must be the best global answer.

```
def subseq(w1, w2):
#True iff word1 is a subsequence of word2.
i = 0
for c in w2:
if i < len(w1) and w1[i] == c:
i += 1
return i == len(w1)
A.sort(key = len, reverse = True)
for i, word1 in enumerate(A):
if all(not subseq(word1, word2)
for j, word2 in enumerate(A) if i != j):
return len(word1)
return -1
```