Saleh127

cf 1223B

Jul 16th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9.  
  10. ll d=0,e,f,i,j,k,l;
  11. string a,c;
  12. test
  13. {
  14. d=0;
  15. cin>>a>>c;
  16. sort(a.begin(),a.end());
  17. sort(c.begin(),c.end());
  18. for(i=0; i<c.size(); i++)
  19. {
  20. for(j=0; j<c.size(); j++)
  21. {
  22. if(a[i]==c[j])
  23. {
  24. d=1;
  25. break;
  26. }
  27. }
  28. }
  29. if(d) cout<<"YES"<<endl;
  30. else cout<<"NO"<<endl;
  31. }
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment