Advertisement
amine99

Untitled

Mar 28th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define itloop(it,x) for(auto it=x.begin();it!=x.end();it++)
  5. #define reloop(i,e,b) for(auto i=e;i>=b;i--)
  6. #define loop(i,b,e) for(auto i=b;i<=e;i++)
  7. #define ALL(x) x.begin(),x.end()
  8. #define SZ(x) x.size()
  9. #define PB push_back
  10. #define MP make_pair
  11. #define F first
  12. #define S second
  13. #define sf scanf
  14. #define pf printf
  15. typedef long long LL;
  16. typedef vector<int> VI;
  17. typedef vector<LL> VLL;
  18. typedef pair<int,int> PI;
  19. typedef pair<LL,LL> PL;
  20.  
  21. const int N=1e5+1;
  22. char a[N],b[N];
  23. int n;
  24.  
  25. int main()
  26. {
  27.    sf("%d",&n);
  28.    loop(i,1,n) {
  29.       map<char,int> m;
  30.       int cnt=0;
  31.       sf("%s%s",&a,&b);
  32.       int lb = strlen(b)-1;
  33.       int la = strlen(a)-1;
  34.       loop(i,0,lb)
  35.          m[b[i]]++;
  36.       loop(i,0,min(lb,la)) {
  37.          if(m[a[i]] != 0) {
  38.             cnt++;
  39.             m[a[i]]--;
  40.          }
  41.       }
  42.       pf("%d\n",cnt);
  43.    }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement