fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #ifndef M
  4. #define M 1000000007
  5. #endif
  6. #ifndef ONLINE_JUDGE
  7. #define gc getchar
  8. #else
  9. #define gc getchar_unlocked
  10. #endif
  11. typedef pair<int,int>pp;
  12. typedef std::vector<pp> vpp;
  13. typedef long long ll;
  14. typedef long double ld;
  15. #ifndef pb
  16. #define pb push_back
  17. #endif
  18. int min(int x,int y){return(x<y)?x:y;}
  19. int max(int x,int y){return(x>y)?x:y;}
  20. int main(int argc, char const *argv[])
  21. {
  22. int t,q;
  23. scanf("%d",&t);
  24. while(t--)
  25. {
  26. ll a[10]={0};
  27. string s;
  28. cin>>s;
  29. int len=s.size();
  30. for(int i=0;i<len;i++)
  31. a[s[i]-'0']++;
  32. scanf("%d",&q);
  33. printf("%lld\n",a[q]);
  34. }
  35. return 0;
  36. }
Success #stdin #stdout 0s 3464KB
stdin
1
324322321
3
stdout
3