fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. using namespace std;
  5.  
  6. int main() {
  7. int t, cnt;
  8. char j[105], s[105];
  9. scanf("%d", &t);
  10. while(t--) {
  11. cnt=0;
  12. scanf("%s\n%s", &j, &s);
  13. for(int k=0; k<strlen(s); k++) for(int i=0; i<strlen(j); i++) if(s[k]==j[i]) { cnt++; break; }
  14. printf("%d\n", cnt);
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 3344KB
stdin
4
abc
abcdef
aA
abAZ
aaa
a
what
none
stdout
3
2
1
0