解法:
暴力
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define endl '\n'
bool cmp(string& a, string& b) {
if (a.size() != b.size())
return a.size() > b.size();
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) cin >> s[i];
string t0 = s[0];
sort(s.begin(), s.end(), cmp);
for (int i = 1; i < n; i += 2) {
if (s[i-1].size() != s[i].size()) {
cout << "NO" << endl;
return 0;
}
}
cout << t0 << endl;
return 0;
}