O-Nice word
You are given one long word. All its letters are ordered in circle i.e. last letter is previous of first. You need to find longest balanced word You can form from given one, if You go in clockwise direction. (You can start collecting from any letter you want.)
Balanced word is one repeatedly toggle from vowel to consonant. No matter whether starting letter is vowel or consonant. Vowels are: 'A','E','I','O','U'.
InputIn first and only line is sequence of uppercase letters. (no longer then 2000000 letters.
OutputIn only line of output print longest balanced word you can create starting from any and moving in clockwise direction assuming that letters of input sequence form circle. If solution is infinite print word from input. If multiple solution exist, print any of them.
Input:
ACCAB
Output:
CABAC
Input:
ACAANAARAATAAKAAMAALAAPAAGAADA
Output:
APA
NOTE: In 50% of tests given word will be shorter than 256 letters.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.