public class JewelsAndStones {
public int solution(String jewels, String stones) {
int count = 0;
Set<Character> jset = new HashSet<>();
for (char jewel : jewels.toCharArray()) {
jset.add(jewel);
}
for (char stone : stones.toCharArray()) {
if (jset.contains(stone)) {
count++;
}
}
return count;
}
public static void main(String[] args) {
JewelsAndStones jewelsAndStones = new JewelsAndStones();
System.out.println(jewelsAndStones.solution("aA", "aAAbbbb"));
}
}