#771
Jewels and Stones
newbie · 100 · lc easy +12 · verified · 89.5% accepted · 5,449 likes · top 99%
Description
You are given a string jewels listing the types of stones that count as jewels, and a string stones representing your collection. Count how many stones in your collection are also jewels. Matching is case-sensitive ("a" and "A" are different types).
Example 1:
Input: jewels = "aA", stones = "aAAbbbb"
Output: 3
Example 2:
Input: jewels = "z", stones = "ZZ"
Output: 0
Code
1
2
3