#include <iostream>
#include <cstring>
using namespace std;
const int MAX_WORDS = 100;
const int WORDS_LENGTH = 20;
int vowelCount(const char *word) {
int n = 0;
const char *vowel = "aeiouAEIOU";
for (int i = 0; word[i] != '\0'; ++i) {
if (strchr(vowel, word[i]) != 0) {
n++;
}
}
return n;
}
int compareWords(const char *word1, const char *word2) {
return strcmp(word1, word2);
}
void sortWords(char words[][WORDS_LENGTH + 1], int vowelCounts[], int wordCount) {
for (int i = 0; i < wordCount - 1; ++i) {
for (int j = i + 1; j < wordCount; ++j) {
if (vowelCounts[i] > vowelCounts[j] ||
(vowelCounts[i] == vowelCounts[j] && compareWords(words[i], words[j]) > 0)) {
char auxWord[WORDS_LENGTH + 1];
strcpy(auxWord, words[i]);
strcpy(words[i], words[j]);
strcpy(words[j], auxWord);
int auxVowelCount = vowelCounts[i];
vowelCounts[i] = vowelCounts[j];
vowelCounts[j] = auxVowelCount;
}
}
}
}
int main() {
char words[MAX_WORDS][WORDS_LENGTH + 1], word[WORDS_LENGTH + 1];
int vowelCounts[MAX_WORDS], wordCount = 0;
while (cin >> word) {
strcpy(words[wordCount], word);
vowelCounts[wordCount] = vowelCount(words[wordCount]);
wordCount++;
}
sortWords(words, vowelCounts, wordCount);
for (int i = 0; i < wordCount; ++i) {
cout << words[i] << '\n';
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhfV09SRFMgPSAxMDA7CmNvbnN0IGludCBXT1JEU19MRU5HVEggPSAyMDsKCmludCB2b3dlbENvdW50KGNvbnN0IGNoYXIgKndvcmQpIHsKICAgIGludCBuID0gMDsKICAgIGNvbnN0IGNoYXIgKnZvd2VsID0gImFlaW91QUVJT1UiOwogICAgZm9yIChpbnQgaSA9IDA7IHdvcmRbaV0gIT0gJ1wwJzsgKytpKSB7CiAgICAgICAgaWYgKHN0cmNocih2b3dlbCwgd29yZFtpXSkgIT0gMCkgewogICAgICAgICAgICBuKys7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIG47Cn0KCmludCBjb21wYXJlV29yZHMoY29uc3QgY2hhciAqd29yZDEsIGNvbnN0IGNoYXIgKndvcmQyKSB7CiAgICByZXR1cm4gc3RyY21wKHdvcmQxLCB3b3JkMik7Cn0KCnZvaWQgc29ydFdvcmRzKGNoYXIgd29yZHNbXVtXT1JEU19MRU5HVEggKyAxXSwgaW50IHZvd2VsQ291bnRzW10sIGludCB3b3JkQ291bnQpIHsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgd29yZENvdW50IC0gMTsgKytpKSB7CiAgICAgICAgZm9yIChpbnQgaiA9IGkgKyAxOyBqIDwgd29yZENvdW50OyArK2opIHsKICAgICAgICAgICAgaWYgKHZvd2VsQ291bnRzW2ldID4gdm93ZWxDb3VudHNbal0gfHwKICAgICAgICAgICAgICAgICh2b3dlbENvdW50c1tpXSA9PSB2b3dlbENvdW50c1tqXSAmJiBjb21wYXJlV29yZHMod29yZHNbaV0sIHdvcmRzW2pdKSA+IDApKSB7CiAgICAgICAgICAgICAgICBjaGFyIGF1eFdvcmRbV09SRFNfTEVOR1RIICsgMV07CiAgICAgICAgICAgICAgICBzdHJjcHkoYXV4V29yZCwgd29yZHNbaV0pOwogICAgICAgICAgICAgICAgc3RyY3B5KHdvcmRzW2ldLCB3b3Jkc1tqXSk7CiAgICAgICAgICAgICAgICBzdHJjcHkod29yZHNbal0sIGF1eFdvcmQpOwogICAgICAgICAgICAgICAgaW50IGF1eFZvd2VsQ291bnQgPSB2b3dlbENvdW50c1tpXTsKICAgICAgICAgICAgICAgIHZvd2VsQ291bnRzW2ldID0gdm93ZWxDb3VudHNbal07CiAgICAgICAgICAgICAgICB2b3dlbENvdW50c1tqXSA9IGF1eFZvd2VsQ291bnQ7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgY2hhciB3b3Jkc1tNQVhfV09SRFNdW1dPUkRTX0xFTkdUSCArIDFdLCB3b3JkW1dPUkRTX0xFTkdUSCArIDFdOwogICAgaW50IHZvd2VsQ291bnRzW01BWF9XT1JEU10sIHdvcmRDb3VudCA9IDA7CiAgICB3aGlsZSAoY2luID4+IHdvcmQpIHsKICAgICAgICBzdHJjcHkod29yZHNbd29yZENvdW50XSwgd29yZCk7CiAgICAgICAgdm93ZWxDb3VudHNbd29yZENvdW50XSA9IHZvd2VsQ291bnQod29yZHNbd29yZENvdW50XSk7CiAgICAgICAgd29yZENvdW50Kys7CiAgICB9CiAgICBzb3J0V29yZHMod29yZHMsIHZvd2VsQ291bnRzLCB3b3JkQ291bnQpOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCB3b3JkQ291bnQ7ICsraSkgewogICAgICAgIGNvdXQgPDwgd29yZHNbaV0gPDwgJ1xuJzsKICAgIH0KICAgIHJldHVybiAwOwp9