389. Find the Difference

来源:互联网 发布:php7不支持mysql 编辑:程序博客网 时间:2024/06/04 17:57
class Solution(object):
    def findTheDifference(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: str
        """
        dic,dif=collections.Counter(s),collections.Counter(t)
        for i in dif:
            if i not in dic or dic[i]!=dif[i]:
                return i

        return

返回不一样的元素