You are given two strings:
precious → representing the types of stones that are considered precious, and
stones → representing all the stones you currently have.
Each character in stones represents one stone.
Your task is to determine how many stones you own are precious.
Note:
Characters are case-sensitive, meaning 'a' and 'A' are treated as different stones.
Input: precious = "mN" stones = "nnmmMN"
Output: 3
Explanation:
Precious stones are 'm' and 'N'. In "nnmmMN", the precious stones found are 'm', 'm', and 'N' → total = 3.
Input: precious = "xX" stones = "xxXXxyz"
Output: 5
Explanation:
Precious stones are 'x' and 'X'. In "xxXXxyz", there are two 'x' and two 'X' → total = 4.
Accepted:
Submission: