QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#662777 | #8829. Aibohphobia | daoqi# | WA | 0ms | 3528kb | C++20 | 947b | 2024-10-21 10:18:09 | 2024-10-21 10:18:10 |
Judging History
answer
#include<bits/stdc++.h>
using i64 = long long;
using l64 = long double;
void DAOQI() {
std::string s, t;
std::cin >> s;
if (s.size() == 1) {
std::cout << s << "\n";
return;
}
std::vector<int> a(26);
for (char c: s) a[c - 'a']++;
for (int i = 0; i < 26; i++) {
if (a[i] == 0) continue;
t += char(i + 'a');
for (int j = i + 1; j < 26; j++) {
t += std::string(a[j], j + 'a');
}
t += std::string(a[i] - 1, i + 'a');
break;
}
for (int l = 0, r = t.size() - 1; l < r; l++, r--) {
if (t[l] != t[r]) {
std::cout << "YES\n";
std::cout << t << "\n";
return;
}
}
std::cout << "NO\n";
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T = 1;
std::cin >> T;
while (T--) DAOQI();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3528kb
input:
5 a sos abba icpc tenet
output:
a YES oss NO YES cipc YES entte
result:
wrong answer Token parameter [name=yes/no] equals to "a", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 1)