Jewels & Stones Solution: 52411510
Sample test cases are passing but wrong answer on submit.
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin>>T;
while(T--){
int c=0;
char ch;
string st1,st2;
cin>>st1>>st2;
set<char> s1(begin(st1),end(st1)), s2(begin(st2),end(st2));
for(auto it1=s1.begin();it1!=s1.end();it1++){
if(s2.find(*it1)!=s2.end()){
c++;
}
}
cout << c << endl;
}
return 0;
}
I don’t know whats the problem.