#include <csetjmp>
class Solution {
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param jewels string字符串
* @param stones string字符串
* @return int整型
*/
int numJewelsInStones(string jewels, string stones) {
// write code here
set<char> setJew;
for (auto s : jewels) {
setJew.insert(s);
}
int count = 0;
for (auto s : stones) {
if(setJew.find(s) != setJew.end()) {//石头是每个都要去看一下是不是属于宝石的
count++;
}
}
return count;
}
};



京公网安备 11010502036488号