#include using namespace std; struct stack { int inf; stack *next; }; void push(stack *&h, int x) { stack *r = new stack; r->inf = x; r->next = h; h = r; } int pop(stack *&h) { int i = h->inf; stack *r = h; h = h->next; delete r; return i; } void reverse(stack *&h) { stack *head1 = NULL; while (h) push(head1, pop(h)); h = head1; } stack *result(stack *&h) { stack *tmp = NULL; stack *res = NULL; while (h) { int c; c = pop(h); if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') push(tmp, c); else push(res, c); } reverse(res); while (tmp) { int elem; elem = pop(tmp); push(res, elem); } return res; } int main() { int n; cout << "n = "; cin >> n; stack *head = NULL; char x; for (int i = 0; i < n; i++) { cin >> x; push(head, int(x)); } reverse(head); stack *res = result(head); while (res) cout << char(pop(res)) << " "; cout << endl; return 0; }