Leetcode 771. Jewels and Stones

class Solution(object):
    def numJewelsInStones(self, J, S):
        """
        :type J: str
        :type S: str
        :rtype: int
        """
        count=collections.Counter(S)
        ans=0
        for j in J:
            ans+=count.get(j,0)
        return ans
原文地址:https://www.cnblogs.com/zywscq/p/10562590.html