0x00 Link
-
Source
-AtCoder
-
Tag
-芝士水题
-
Time
- ∗ * ∗
0x01 Source Code
//
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
void solve() {
int n;
cin >> n;
string s;
cin >> s;
int cntT = 0, cntA = 0;
char ch = ' ';
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'T') cntT++;
else if (s[i] == 'A') cntA++;
if (ch == ' ') {
if (cntT >= n / 2) ch = 'T';
if (cntA >= n / 2) ch = 'A';
}
}
if (cntT == cntA) cout << ch << endl;
else cout << (cntT > cntA ? 'T' : 'A') << endl;
}
signed main() {
IOS
int t = 1;
// cin >> t;
while (t--) solve();
return 0;
}
0x10 Diagram
-
404
0x11 Reference
-
404
作者 | 乐意奥AI