fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7.  
  8. string target = "Timur";
  9. sort(target.begin(), target.end());
  10.  
  11. while (t--) {
  12. int n;
  13. string s;
  14. cin >> n >> s;
  15.  
  16. if (n != 5) {
  17. cout << "NO\n";
  18. continue;
  19. }
  20.  
  21.  
  22. sort(s.begin(), s.end());
  23.  
  24. if (s == target)
  25. cout << "YES\n";
  26. else
  27. cout << "NO\n";
  28. }
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 5324KB
stdin
10
5
Timur
5
miurT
5
Trumi
5
mriTu
5
timur
4
Timr
6
Timuur
10
codeforces
10
TimurTimur
5
TIMUR
stdout
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO