fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int t;
  5. string s;
  6.  
  7. string check(){
  8. if (s.size() % 2 != 0) return "NO";
  9. int d = 0;
  10. for (int i = 0; i < s.size() / 2; i++)
  11. d += s[i];
  12. for (int i = s.size() / 2; i < s.size(); i++)
  13. d -= s[i];
  14. return (d == 0 ? "YES" : "NO");
  15. }
  16.  
  17. int main(){
  18. ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  19. cin >>t;
  20. while (t--){
  21. cin >>s;
  22. cout <<check() <<'\n';
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5436KB
stdin
Standard input is empty
stdout
Standard output is empty