fork download
  1. /*
  2.  *
  3.  */
  4. #include <bits/stdc++.h>
  5. using namespace std;
  6. #define ll long long
  7. #define int long long
  8. #define el '\n'
  9. #define all(v) v.begin(), v.end()
  10. const int mod = 1000000000 + 7, OO = 0x3f3f3f3f;
  11. const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
  12. const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
  13. const char di[] = {'U', 'R', 'L', 'D'};
  14.  
  15. void solve() {
  16.  
  17. string s;
  18. cin >> s;
  19. int cntA = 0, cntB = 0;
  20. for (int i = 0; i < s.size(); ++i) {
  21. if (s[i] == 'A') cntA++;
  22. else cntB++;
  23. }
  24.  
  25. cout << (cntA > cntB ? 'A' : 'B') << el;
  26.  
  27. }
  28.  
  29.  
  30. int32_t main() {
  31. ios_base::sync_with_stdio(false);
  32. cout.tie(nullptr), cin.tie(nullptr);
  33.  
  34. // if(fopen("in.txt", "r")){
  35. // freopen("in.txt", "r", stdin);
  36. // freopen("out.txt", "w", stdout);
  37. // }
  38.  
  39. int tt = 1;
  40. cin >> tt;
  41. while (tt--) {
  42. solve();
  43. }
  44.  
  45. return 0;
  46. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
B