771. Jewels and Stones leetcode solution in c++

class Solution {
public:
    int numJewelsInStones(string jewels, string stones) {
        int res = 0;
        for (char s : stones) {
            for (char j : jewels) {
                if (s == j) {
                    res++;
                    break;
                }
            }
        }
        return res;
    }
};