QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#185810#2374. Cycle String?Hanx16MsgrAC ✓7ms6268kbC++141.0kb2023-09-22 17:04:202023-09-22 17:04:21

Judging History

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

  • [2023-09-22 17:04:21]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:6268kb
  • [2023-09-22 17:04:20]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i, a, b) for (int i = (a); i <= (b); ++i)
#define Rof(i, a, b) for (int i = (a); i >= (b); --i)
using namespace std;
using i64 = long long;
constexpr int _N = 1e6 + 5;
string c;
deque<pair<int, int>> q;
int cnt[26];
signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> c;
	int n = c.length() / 2;
	for (char t : c) ++cnt[t - 'a'];
	int maxn = 0, p = 0;
	For(i, 0, 25) if (cnt[i] > maxn) maxn = cnt[i], p = i;
	string ans;
	if (maxn > n) {
		int tmp = 0, tp = 0;
		For(i, 0, 25) if (cnt[i] != maxn) tmp += cnt[i], tp += cnt[i] != 0;
		if ((tmp <= 2 && tp == 1) || !tp) return cout << "NO\n", 0;
		vector<int> q;
		For(i, 0, 25) if (i != p)
			For(j, 1, cnt[i]) q.push_back(i);
		tmp = 0;
		For(i, 1, maxn) {
			++tmp; ans += p + 'a';
			if (tmp == n) {
				ans += q.back() + 'a';
				tmp = 0;
				q.pop_back();
			}
		}
		for (int x : q) ans += x + 'a';
	} else {
		For(i, 0, 25) For(j, 1, cnt[i])
			ans += i + 'a';
	}
	cout << "YES\n" << ans << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3784kb

input:

cbbabcacbb

output:

YES
aabbbbbccc

result:

ok The contestant and jury found an answer

Test #2:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

aa

output:

NO

result:

ok Solution does not exist

Test #3:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

afedbc

output:

YES
abcdef

result:

ok The contestant and jury found an answer

Test #4:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

cghfbdae

output:

YES
abcdefgh

result:

ok The contestant and jury found an answer

Test #5:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

babcacca

output:

YES
aaabbccc

result:

ok The contestant and jury found an answer

Test #6:

score: 0
Accepted
time: 0ms
memory: 3484kb

input:

hfjeacbdgi

output:

YES
abcdefghij

result:

ok The contestant and jury found an answer

Test #7:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

fblcmcafgichjocodacanejmiaghclclmpnjcklkelhijghmgkhicdaafkgiaenjefkmmminihdfmiokjghdnohmddmgae

output:

YES
aaaaaaaabcccccccccddddddeeeeefffffggggggghhhhhhhhiiiiiiiijjjjjjkkkkkklllllmmmmmmmmmmnnnnnoooop

result:

ok The contestant and jury found an answer

Test #8:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

babaccacbcacacbcabbcacacbbbbabccbcbaabbbabcbbcacaaccbbbaaacacaccaacabaabaaaabaabbccabcaaacccccabbcbacabccbacabacaccbbabccccabbacccbaacacaccbacababcaccaccacacbaaccbcccaaacaabbacbcbbcccaaaacbbcccccccccaabbcabcbcacbccaababcaaccccaccbcbacaacbaacbbaacbaacbacaaaacaaacbbbaccbabcababaccacacccbcbbcccaaaababa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb...

result:

ok The contestant and jury found an answer

Test #9:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

ccfaehbdffhadecdgacahfgbbbgcccfhfdbafbadddcgcfdafccdcafhaggeaghchcdegbfcecbhdhefdahddaeadacbachgdcchdcfdbefbbdcadegbefghceehabcaggahfahcgdchdbfhhcdefaadafcgdcfefdhebddhfahehedeefhcbdedafdaggbgggeadecgeefafafedcfgeehbhefhdfgdbebadeefdhhdedbgdfeehfchhfeffdfffghhehfbfegacbehdehcdaadhfhgdbhcaghcccgdcgdd...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #10:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

ifeehacdbg

output:

YES
abcdeefghi

result:

ok The contestant and jury found an answer

Test #11:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

gwrffzdydmtyficvthjgseannpwxxkaqyrykfbziqszdirlwkqzsvwohmmcaudpyovcnfddsdvvytpdsal

output:

YES
aaaabcccddddddddefffffgghhiiijkkkllmmmnnnoopppqqqrrrssssstttuvvvvvwwwwxxyyyyyyzzzz

result:

ok The contestant and jury found an answer

Test #12:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

gbmfhaeabeleiagcllhiiifmchighalckkghajaihiagmclibehjbaegdajebjhfbidahblcbemcdmmjbcdbhbdfldljmffgcbkdmacmjccmbjjmjccbaiiaffegbblbhehfaljdedhmkhldefdhgfgeagdglijediihclkcklcaefdmedkffabfcaliheaiaiagaegejmmddkkedbigkmdammkhemllbckieefclhglhgeabgfffkijjemekmkjggdjehmidbjjjhljdmjkeijaigiffkhfehkekglcaeje...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

result:

ok The contestant and jury found an answer

Test #13:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

pangkaeejgcohrfranglmibbnmldpriqndrjbhqcfdibgjlhedbghhiqcbhafrcpchhdjfakqnikdgpqcghcknnqrgpjjdhnjhbjhljdoorojmfbrrlljmimqfdrojmfldpdmclafhkmidqhalnrikcgmqgcnihorfnbojmfrrflqkmgbpqbieeffjbphrekocrmjjjopojmqahpeqpfkpmhpriarlmgoqmmjhdbpoaaiggpppgnhlfckcndmmklafdpnkgrkrgfhcgfhogghcmiobhgpjeenffmgbjjbdca...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #14:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

NO

result:

ok Solution does not exist

Test #15:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

NO

result:

ok Solution does not exist

Test #16:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

NO

result:

ok Solution does not exist

Test #17:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

baabba

output:

YES
aaabbb

result:

ok The contestant and jury found an answer

Test #18:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

aaabbaabbbabbaaabbbbbbbbabaaaaabbababaaaabaaaabbbaababbb

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb

result:

ok The contestant and jury found an answer

Test #19:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

baabaaabaabaabbaaaababbababbababaaabbaabaaabaaaabbbaaabaabaaaabbbbaabbabbabbabaaababbabaabbabbbabaabbabbbbbbbbaaabbabbaaaaaaabaaaaaababaaabbaabbaabaaabaaabbabbbabaaaabbbabaaaaabaababaaabababaababababbbaabababbaaabbbbbaabaabababbaaaabaabbbaababbaabbbaababbbbaaaababbabababbbabbbbabaabaabaabbbbbabbabbb...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #20:

score: 0
Accepted
time: 0ms
memory: 4000kb

input:

bbbaaabbbaaabbaabababbababbbaaaababbbaaabaababaabbaaababbbabbbababbbbbabbabbabaaabbababababbaabaabbbabbababbaabbabaabbaabbbabaaaaabbabbbbbababaaaaabbbbbabaaabbaabaaabbababbabaaaaaaaaabbaabbaaababbabbaababbabbabbabbbaaaaaabbababbabbbbbaaaaabbbabbbbaaaaaaababbabaaaabaabbbbaaaaaababaabaababbbbbbabaabaa...

output:

YES
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

result:

ok The contestant and jury found an answer

Test #21:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

bbacaabbcaaacccbabcaacab

output:

YES
aaaaaaaaaabbbbbbbccccccc

result:

ok The contestant and jury found an answer

Test #22:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

bbabcaccabacccbbaababbbbbcbabbcacbcbacacacbbbcbbbcacccacaccbcaacbbbacaacaccbaabacaaabaaacabcaacacbbcbabaccacacccbacabbbbccacbaabcabacbbacbaabaaaabcccbaacabbccbaccbccacbcaccbcbacbbacaccaaaaabccabacabcbbacccabaccbaababbccbbbbababbbaaacbabaaaabbaaaaababcabbaaaaaaccacccbbaacbabbbcacbcabbbbacccbbbcaaabcc...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #23:

score: 0
Accepted
time: 5ms
memory: 5580kb

input:

cccccabccacabbabcaabcacabbbbcbbbabaccabcbbbcabababcabcbbaccbcbaaababccbaccaaacbbbcbccbcbbbabbbaabcabcaaaacbcccababbaccabacccabbaaabbcaccaacbcbccbbbacbbcccacbabbbcabacabcabcabcabbacbcaacaabccabbabbcaacaccbabccacaccababbaababaabbcabbbaaabaccbbcbcaaabccbaccbcbaabcabcbbbbbbbbabcbccbccaabaacaacbabbbcacac...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #24:

score: 0
Accepted
time: 2ms
memory: 4140kb

input:

eqkhnrkaytrgbwpmopavlpkakdveoyvwudwytxmgtwossflwskfiyqjstgykwbimitkefitjhyvgyswancnfrbuoqpqjjirfxarxybouwidptteqlckyrfnjucpjvpvnrykqykvxlcuyvxlyvvkqlsucsrdmscnswmefrkbmkdegvmeecmeutfquguosbgwdayyodcrqowjetqrjjydmnotedicfpmyoocbkqbdiiusinmvervloqrlwdkyhnvgakqheaejqfjfdchgohhjasgtkcpoyyfrflokjhptdwqjt...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #25:

score: 0
Accepted
time: 4ms
memory: 5252kb

input:

jiicbbaheebcidjgcaihedbichhaijgiahcijafdeegajgigeaaicifecggjiddgedbfcfcecedadgjeaihhffhbchecchdjgabgigaebfbdhdiiadgiaeaiiahhjiighcjfefgdgjibcifjgiiaafadeieaafjceebhhjbedeibhaejbeecdadhafifhcihhifdjbhjedhfjhafgbgbfgdeabccieibebicgcaicgcafjdicfbgefebagjdfbiihdcbdbajcgdddjfediaijdccjhefcgiecedfcfchcigh...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #26:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

pebefqcnesiqgkhobernbhgbbenppejlonforlpbqloosfefoiacelqiicgjslbrjlrrslrmmkeaqoensnpacaooblkqocqcqlifkrlrgoqarhnnphrcriphojijdqisdrbshnhiljhifpgppsmrccfppslopampejdssnrsfojsaanqaonlghnarhqdajfprreioepckooofjanipahplsoidnqjmfchhpipbhgqklhfrbaodakhgabodakpjaakhsfnjnpskoleffpsfllnbrgprclnjkhggsjmprasmcc...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #27:

score: 0
Accepted
time: 1ms
memory: 4016kb

input:

baabaaabbabbabbbabaaabbababbaaaaaaaababaabbbbaababaababbaabbbabbbbabbbabbabbbabaabbabbbaababaaaabbbaaaaaaaaaababbbabbabbaaaabaabbbbbabbbbbbbbabbbaaabbabbbbbabaabbbaabaabababbbabaababbaabbbbabbbbabaaaaabbbbababababbabbbbaaaabbbbaabbbabbbbbbbabbabbaabbbbbbaaaaabaaaabbbabbbbabbabaabbaaaabaabbbbbbbbbaab...

output:

YES
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

result:

ok The contestant and jury found an answer

Test #28:

score: 0
Accepted
time: 5ms
memory: 5136kb

input:

giiilhifbalmiceefhegdmfbkbhjdimijhfhbllkahekkdkcggadaeakdhmglmfjmibbgkbeeffgdaffbacmdeleldlihafcemfjgjmfjkjmdjgbidmjjcbfjkefkdjlahllkmiiegebmckjfchbgmiecdlcdmibejaekhkamffhciflfiaafbahcklelghleefchladcaacjkbkgambjijgfamgkjegfmbahikmjbcbcaliedgkjicfajmalmheddjfeaeflddcelgjfefddabgfgjmgkfaeeclkjdggdbl...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #29:

score: 0
Accepted
time: 0ms
memory: 4020kb

input:

eehihehiaegegieecagbbaeccicbhajjfagbfaegjafeadidaeefgeddejdgfecbejaijdccjbcggebdjgabhddibgaeidafhdfejgihjegebbdgajaebdgaeehbihiihjfjjacjhjaeidacgbejbjgigeheicbcejahhiibjcchiadigcfdbfgaedjadaefjfagbfagccejfbgaacejcdaihifidjhfaiijgajcfjaifhifbbhcegacdbbedfdigbgibaiiajagfdfcaabbffffiieijahifjhdgahgfige...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #30:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

abfedgdgafadeeaeadbeabdcdbfbbebdbgdddaeegeecebgcdgbcgefeadefgddbecedbcgacbbffdgefgbdaebfdaafdddcgecaagegdfgdafafcaadggdagdaeedagaegdcfdedcefggcgbedafbbcbdfbegfagcegdfggagdgfeagbbddcfcbbdbbaegdedfdagggbdafebfgacdefeabbdecbeaceeaebgeaaddegfaedbfgggaeecabfacadbcadgcgbcbefcdabbdbbcggafgadffadcaagebadecc...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #31:

score: 0
Accepted
time: 0ms
memory: 5516kb

input:

babbbabbaabbbbaaababaaaaabbaaaabaaaaaabbaaaaababbabbaabbbbaabbababbbbabbbaabaabbaaaaaaabaaaaaaabbabbababbababbabbbbaaaaaaaaabaaaaabbabaabbaabbaabbaaabbbbbbaabaaabbbbaabbabbabaaabbbaaabaabbaaabaaaabbbaabbbaaabaabaaababbaabababbbabaabbaabbbbaaaaababbabbaaabbbabaabbaabbbaaabababbbbbabbbbbbabbbaabbaabba...

output:

YES
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

result:

ok The contestant and jury found an answer

Test #32:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

abcabc

output:

YES
aabbcc

result:

ok The contestant and jury found an answer

Test #33:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

bc

output:

YES
bc

result:

ok The contestant and jury found an answer

Test #34:

score: 0
Accepted
time: 0ms
memory: 3488kb

input:

zbzz

output:

NO

result:

ok Solution does not exist

Test #35:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

zbbz

output:

YES
bbzz

result:

ok The contestant and jury found an answer

Test #36:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

aabbbb

output:

NO

result:

ok Solution does not exist

Test #37:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

aaabbbbb

output:

YES
bbbbabaa

result:

ok The contestant and jury found an answer

Test #38:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

aaabbb

output:

YES
aaabbb

result:

ok The contestant and jury found an answer

Test #39:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

aazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

NO

result:

ok Solution does not exist

Test #40:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

dzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

NO

result:

ok Solution does not exist

Test #41:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

aaaabc

output:

YES
aaacab

result:

ok The contestant and jury found an answer

Test #42:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

aaaabcde

output:

YES
aaaabcde

result:

ok The contestant and jury found an answer

Test #43:

score: 0
Accepted
time: 4ms
memory: 6160kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #44:

score: 0
Accepted
time: 7ms
memory: 5512kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #45:

score: 0
Accepted
time: 0ms
memory: 6268kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #46:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #47:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #48:

score: 0
Accepted
time: 4ms
memory: 6260kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #49:

score: 0
Accepted
time: 4ms
memory: 5244kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer

Test #50:

score: 0
Accepted
time: 2ms
memory: 5448kb

input:

abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok The contestant and jury found an answer