int numJewelsInStones(string J, string S) { set<char> st; int count = 0; for (auto c : J) { st.insert(c); } for (auto s : S) { if (st.find(s) != st.end()) { count++; } } return count; }