#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <ctype.h>
typedef struct Node {
char word[50];
struct Node *next;
} Node;
Node *head,
*head2;
char end[3] = "?!.", word[50];
int k = 0;
char ch;
int main(int argc, char const *argv[]) {
do
{
if( k ) {
Node
*new_node
= (Node
*)malloc(sizeof(Node
)); new_node->next = NULL;
if(head == NULL) {
head = new_node;
head2 = new_node;
} else {
if(strcmp(head
->word
, new_node
->word
) > 0) {
new_node->next = head;
head = new_node;
} else {
Node *aux = head;
while(aux
->next
&& strcmp(aux
->next
->word
, new_node
->word
) < 0) {
aux = aux->next;
}
if(aux->next) {
new_node->next = aux->next;
aux->next = new_node;
} else {
aux->next = new_node;
}
}
}
k = 0;
}
} else {
word
[k
++] = toupper(ch
); word
[k
] = '\0';
}
while(head) {
head = head->next;
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPG1hbGxvYy5oPgojaW5jbHVkZSA8Y3R5cGUuaD4KCnR5cGVkZWYgc3RydWN0IE5vZGUgewogICAgICAgIGNoYXIgd29yZFs1MF07CiAgICAgICAgc3RydWN0IE5vZGUgKm5leHQ7Cn0gTm9kZTsKCk5vZGUgKmhlYWQsCiAgICAgKmhlYWQyOwoKY2hhciBlbmRbM10gPSAiPyEuIiwgd29yZFs1MF07CgppbnQgayA9IDA7CgpjaGFyIGNoOwoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgY29uc3QgKmFyZ3ZbXSkgewoKICBkbwogIHsKICAgICBzY2FuZigiJWMiLCAmY2gpOwoKICAgICBpZighaXNhbHBoYShjaCkpIHsKCiAgICAgIGlmKCBrICkgewoKICAgICAgIE5vZGUgKm5ld19ub2RlID0gKE5vZGUqKW1hbGxvYyhzaXplb2YoTm9kZSkpOwogICAgICAgc3RyY3B5KG5ld19ub2RlLT53b3JkLCB3b3JkKTsKICAgICAgIG5ld19ub2RlLT5uZXh0ID0gTlVMTDsKCiAgICAgICBpZihoZWFkID09IE5VTEwpIHsKCiAgICAgICAgIGhlYWQgPSBuZXdfbm9kZTsKCiAgICAgICAgIGhlYWQyID0gbmV3X25vZGU7CgogICAgICAgfSBlbHNlIHsKCiAgICAgICAgICBpZihzdHJjbXAoaGVhZC0+d29yZCwgbmV3X25vZGUtPndvcmQpID4gMCkgewoKICAgICAgICAgICAgbmV3X25vZGUtPm5leHQgPSBoZWFkOwoKICAgICAgICAgICAgaGVhZCA9IG5ld19ub2RlOwoKICAgICAgICAgIH0gZWxzZSB7CgogICAgICAgICAgICBOb2RlICphdXggPSBoZWFkOwoKICAgICAgICAgICAgd2hpbGUoYXV4LT5uZXh0ICYmIHN0cmNtcChhdXgtPm5leHQtPndvcmQsIG5ld19ub2RlLT53b3JkKSA8IDApIHsKCiAgICAgICAgICAgICAgICBhdXggPSBhdXgtPm5leHQ7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGlmKGF1eC0+bmV4dCkgewoKICAgICAgICAgICAgICBuZXdfbm9kZS0+bmV4dCA9IGF1eC0+bmV4dDsKCiAgICAgICAgICAgICAgYXV4LT5uZXh0ID0gbmV3X25vZGU7CgogICAgICAgICAgICB9IGVsc2UgewoKICAgICAgICAgICAgICBhdXgtPm5leHQgPSBuZXdfbm9kZTsKICAgICAgICAgICAgfQoKICAgICAgICAgIH0KICAgICAgIH0KCiAgICAgICBrID0gMDsKICAgICB9CgogICAgIH0gZWxzZSB7CgogICAgICAgd29yZFtrKytdID0gdG91cHBlcihjaCk7IHdvcmRba10gPSAnXDAnOwoKICAgICB9CgogIH0gd2hpbGUoIXN0cnJjaHIoZW5kLCBjaCkpOwoKICB3aGlsZShoZWFkKSB7CiAgICAKICAgIHByaW50ZigiJXMgIiwgaGVhZC0+d29yZCk7CiAgICAKICAgIGhlYWQgPSBoZWFkLT5uZXh0OwogIH0KICByZXR1cm4gMDsKfQo=