fork download
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int t;
  8. cin>>t;
  9. while(t--)
  10. {
  11. int c=0,i;
  12. string s,s1;
  13. cin>>s>>s1;
  14. sort(s.begin(),s.end());
  15. sort(s1.begin(),s1.end());
  16. if(s.length()!=s1.length())
  17. {
  18. cout<<"false"<<"\n";
  19. break;
  20. }
  21.  
  22. for(i=0;i<s.length();i++)
  23. {
  24. if(s[i]==s1[i])
  25. {
  26. c++;
  27. }
  28.  
  29. }
  30. if(s.length()==c)
  31. {
  32. cout<<"True"<<'\n';
  33. }
  34. else
  35. {
  36. cout<<"False"<<'\n';
  37. }
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0s 5504KB
stdin
4
a a
b h
stop post
hi hey
stdout
True
False
True
false