771 桶排
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
int numJewelsInStones(string J, string S)
{
int sum = 0;
int count[58]={0};//65~90A~Z 97~122a~z
for (int i = 0; i < S.size();i++)
{
count[S[i]-'A'] ++;
}
for (int i = 0; i < J.size();i++)
{
sum += count[J[i]-'A'];
}
return sum;
}
int main()
{
char J[50];
char S[50];
cin>>J;
cin>>S;
cout<<numJewelsInStones(J,S)<<endl;
return 0;
}