天天看點

leetcode - 884 - 兩句話中的不常見單詞

class Solution:

    def uncommonFromSentences(self, A, B):

        """

        :type A: str

        :type B: str

        :rtype: List[str]

        """

        C = A.split() + B.split()

        L =[]

        for s in C:

            if C.count(s) == 1:

                L.append(s)

        return L