QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#460584#8829. AibohphobiaQwertyPi#WA 1ms3544kbC++14673b2024-07-01 21:12:382024-07-01 21:12:40

Judging History

你现在查看的是最新测评结果

  • [2024-07-01 21:12:40]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3544kb
  • [2024-07-01 21:12:38]
  • 提交

answer

#include <bits/stdc++.h>
#define all(a) begin(a), end(a)
#define sz(a) (int) (a).size();
using namespace std;

void solve() {
    string s; cin >> s;
    map<char, int> M;
    for (auto c : s) {
        M[c]++;
    }

    if (M.size() <= 2) {
        cout << "NO" << '\n';
        return;
    }

    cout << "YES" << '\n';
    for (auto [c, cc] : M) {
        cout << c;
    }
    for (auto [c, cc] : M) {
        for (int  i = 1; i < cc; i++) {
            cout << c;
        }
    }
    cout << '\n';
}

int32_t main(){
    cin.tie(0); cout.tie(0)->sync_with_stdio(false);
    int t; cin >> t;
    while (t--) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3544kb

input:

5
a
sos
abba
icpc
tenet

output:

NO
NO
NO
YES
cipc
YES
entet

result:

wrong answer Jury found the answer but participant didn't (test case 1)