Problem 832
Jewels and Stones
Easy · 10 pts · String, Hash Table
Problem
The string J lists the types of stones that are jewels, one letter per type, with no repeats. The string S lists the stones you have, one letter per stone. Count how many of your stones are jewels. Letters are case-sensitive, so a and A are different types. Put the jewel types in a set, then count the stones whose letter is in it.
Input
The first line contains J. The second line contains S. Both use English letters.
Output
Print the number of stones that are jewels.
Constraints
1 <= |J|, |S| <= 100000; the letters of J are distinct
Example input
aA aAAbbbb
Example output
3
Explanation
With jewels aA and stones aAAbbbb, the stones a, A and A are jewels, so the answer is 3.