#include <iostream>
typedef struct stack{
char ch;
struct stack *link;
} Stack;
void push(Stack**head, char c) {
Stack *node = new Stack;
node->ch = c;
node->link = (*head);
(*head) = node;
};
void print(Stack *p) {
while(p) {
p = p->link;
}
};
int main(int argc, char const *argv[]) {
Stack *stack = NULL;
char const *str;
str = "MayAnnCampanera";
int cnt = 0;
while(str[cnt]!='\0') {
cnt++;
}
for(int i = 0; i < cnt; ++i) push(&stack, str[i]);
print(stack);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogCnR5cGVkZWYgc3RydWN0IHN0YWNrewogIGNoYXIgY2g7CiAgc3RydWN0IHN0YWNrICpsaW5rOwp9IFN0YWNrOwogCnZvaWQgcHVzaChTdGFjayoqaGVhZCwgY2hhciBjKSB7CiAgICAgU3RhY2sgKm5vZGUgPSBuZXcgU3RhY2s7CiAgICAgbm9kZS0+Y2ggPSBjOwogICAgIG5vZGUtPmxpbmsgPSAoKmhlYWQpOwogICAgICgqaGVhZCkgPSBub2RlOwp9OwogCnZvaWQgcHJpbnQoU3RhY2sgKnApIHsKICAgICB3aGlsZShwKSB7CiAgICAgICBwcmludGYoIiVjIiwgcC0+Y2gpOwogICAgICAgcCA9IHAtPmxpbms7CiAgICAgfQp9OwogCmludCBtYWluKGludCBhcmdjLCBjaGFyIGNvbnN0ICphcmd2W10pIHsKIAogIFN0YWNrICpzdGFjayA9IE5VTEw7CiAKICBjaGFyIGNvbnN0ICpzdHI7CiAKICBzdHIgPSAiTWF5QW5uQ2FtcGFuZXJhIjsKIAogIGludCBjbnQgPSAwOwogCiAgd2hpbGUoc3RyW2NudF0hPSdcMCcpIHsKIAogICAgY250Kys7CiAgfQogIGZvcihpbnQgaSA9IDA7IGkgPCBjbnQ7ICsraSkgcHVzaCgmc3RhY2ssIHN0cltpXSk7CiAKICBwcmludChzdGFjayk7CiAKIAogCiAgcmV0dXJuIDA7Cn0=