https://leetcode.com/problems/jewels-and-stones/description/
题目大意:两个字符串,问第一个字符串中每一个字符在第二个字符串里出现的次数之和是多少
解题思路:遍历统计
class Solution {
public int numJewelsInStones(String J, String S) {
int res =0;
for(int i=0;i<J.length();i++)
{
for(int j=0;j<S.length();j++)
{
if(J.charAt(i)==S.charAt(j))
res++;
}
}
return res;
}
}