version 0.1

class Solution {
public:
    int numJewelsInStones(string J, string S)
    {
        int count = 0;
        for (std::string::iterator it = J.begin(); it != J.end(); it++)
        {
            for (std::string::iterator it1 = S.begin(); it1 != S.end(); it1++)
            {
                if (*it == *it1) 
                {
                    count++;
                }					
            }
        }		
        
        return count;
    }
};

771.宝石与石头

相关文章: