fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. while(t--){
  8. string s;
  9. cin >> s;
  10. int x;
  11. int a[123]={0};
  12. int y=0;
  13. for(int i=0; i<s.length()/2; i++){
  14. x=s[i];
  15. a[x]++;
  16. y++;
  17. }
  18. for(int i=s.length()-y; i<=s.length()-1; i++){
  19. x=s[i];
  20. a[x]--;
  21. }
  22. int flag=0;
  23. for(int i=96; i<123; i++)
  24. {
  25. if(a[x]!=0){
  26. flag=1;
  27. break;
  28. }
  29. }
  30. if(flag==1)
  31. cout << "NO" << endl;
  32. else
  33. cout << "YES" << endl;
  34. }
  35. return 0;
  36. }
Success #stdin #stdout 0s 15240KB
stdin
6
gaga
abcde
rotor
xyzxy
abbaab
ababc
stdout
YES
NO
YES
YES
NO
NO