fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3. #include<string>
  4. #include<algorithm>
  5. int main() {
  6. int n, t=0;
  7. cin>>n;
  8. for(int i=0;i<n;i++)
  9. {
  10. string a,b;
  11. cin>>a>>b;
  12. cout<<"\n";
  13. if(a.length()!=b.length())
  14. {
  15. cout<<"NO";
  16. }
  17. else
  18. {
  19. sort(a.begin(),a.end());
  20. sort(b.begin(),b.end());
  21. if(a != b)
  22. {
  23. cout<<"NO";
  24. }
  25. else
  26. {
  27. cout<<"YES";
  28. }
  29. }
  30. }
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 15240KB
stdin
2
aab baa
a a
stdout
YES
YES