#include <stdio.h>
#include <string.h>
int count_vowel(char *s);
int main() {
char x[20][100];
int N;
int i = 0;
int k = 0;
int count[20];
char temp[100];
int temp_count;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%s", x[i]);
count[i] = count_vowel(x[i]);
}
for (i = 0; i < N - 1; i++) {
for (k = 0; k < N - 1 - i; k++) {
if (count[k] < count[k + 1]) {
strcpy(temp, x[k]);
strcpy(x[k], x[k + 1]);
strcpy(x[k + 1], temp);
temp_count = count[k];
count[k] = count[k + 1];
count[k + 1] = temp_count;
}
}
}
for (i = 0; i < N; i++) {
printf("%s\n", x[i]);
}
return 0;
}
int count_vowel(char *s) {
int count = 0;
char *p = s;
int j = 0;
for (j = 0; *p != '\0'; j++) {
char ch = *p;
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
count++;
}
p++;
}
return count;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: