NCPC26 Practise 2
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Created by zacharias on 2026-04-17.
|
||||
//
|
||||
|
||||
#define MAX 101
|
||||
#include <cstdio>
|
||||
|
||||
int main() {
|
||||
int size = 0;
|
||||
|
||||
while (scanf("%d", &size) == 1) {
|
||||
for (int x = 0; x < size; x++) {
|
||||
char word[MAX];
|
||||
char newword[MAX];
|
||||
|
||||
scanf("%s", word);
|
||||
|
||||
int i = 0;
|
||||
int u = 0;
|
||||
|
||||
while (word[i] != '\0') {
|
||||
if (word[i] == word[i+1] || (i != 0 && word[i+1] != '\0' && (word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u'))) {
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
if (word[i+1] == '\0') {
|
||||
newword[u+1] = '\0';
|
||||
}
|
||||
newword[u] = word[i];
|
||||
i++;
|
||||
u++;
|
||||
}
|
||||
}
|
||||
if (x+1 != size) {
|
||||
printf("%s ", newword);
|
||||
} else {
|
||||
printf("%s\n", newword);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user