#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
typedef struct cel {
char conteudo;
struct cel *prox;
} celula;
typedef struct pilha {
struct cel *cabeca;
} pilha;
void empilha(char c, pilha *p) {
celula
*nova
= (celula
*) malloc(sizeof(celula
)); nova->conteudo = c;
nova->prox = p->cabeca;
p->cabeca = nova;
}
char desempilha(pilha *p) {
celula *pt = p->cabeca;
char c = pt->conteudo;
p->cabeca = pt->prox;
return c;
}
int main() {
char frase[50];
pilha p;
p.cabeca = NULL;
for (int i = 0; frase[i] != '\0'; i++) {
for (; frase[i] != '\0' && frase[i] != ' '; i++) {
empilha(frase[i], &p);
}
while (p.cabeca != NULL) {
}
putchar(frase
[i
] == ' ' ? ' ' : '\n'); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPG1hbGxvYy5oPgogCnR5cGVkZWYgc3RydWN0IGNlbCB7CiAgICBjaGFyIGNvbnRldWRvOwogICAgc3RydWN0IGNlbCAqcHJveDsKfSBjZWx1bGE7CiAKdHlwZWRlZiBzdHJ1Y3QgcGlsaGEgewogICAgc3RydWN0IGNlbCAqY2FiZWNhOwp9IHBpbGhhOwogCnZvaWQgZW1waWxoYShjaGFyIGMsIHBpbGhhICpwKSB7CiAgICBjZWx1bGEgKm5vdmEgPSAoY2VsdWxhICopIG1hbGxvYyhzaXplb2YoY2VsdWxhKSk7CiAgICBub3ZhLT5jb250ZXVkbyA9IGM7CiAgICBub3ZhLT5wcm94ID0gcC0+Y2FiZWNhOwogICAgcC0+Y2FiZWNhID0gbm92YTsKfQogCmNoYXIgZGVzZW1waWxoYShwaWxoYSAqcCkgewogICAgY2VsdWxhICpwdCA9IHAtPmNhYmVjYTsKICAgIGNoYXIgYyA9IHB0LT5jb250ZXVkbzsKICAgIHAtPmNhYmVjYSA9IHB0LT5wcm94OwogICAgZnJlZShwdCk7CiAgICByZXR1cm4gYzsKfQogCmludCBtYWluKCkgewogICAg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