#include <stdio.h>
#include <stdlib.h>
typedef struct Node{
int data;
struct Node *next;
} Node;
Node* read_item(){
int in = 0;
if (scanf("%d", &in
) != 1) return NULL;
Node
* new_item
= (Node
*)calloc(1,sizeof(Node
)); new_item->data = in;
return new_item;
}
void read_list(Node **head){
if(*head == NULL)
*head = read_item();
Node * last_item = *head;
Node * item = NULL;
while((item = read_item())){
last_item->next = item;
last_item = item;
}
}
void print(Node *head){
Node *p;
p = head;
if (!p
) printf("The list is empty\n"); while(p){
p = p->next;
}
}
int main(){
Node *head = NULL;
read_list(&head);
print(head);
int pause;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnR5cGVkZWYgc3RydWN0IE5vZGV7CiAgICBpbnQgZGF0YTsKICAgIHN0cnVjdCBOb2RlICpuZXh0Owp9IE5vZGU7CgpOb2RlKiByZWFkX2l0ZW0oKXsKICAgIGludCBpbiA9IDA7CiAgICBpZiAoc2NhbmYoIiVkIiwgJmluKSAhPSAxKQogICAgICAgIHJldHVybiBOVUxMOwogICAgTm9kZSAqIG5ld19pdGVtID0gKE5vZGUgKiljYWxsb2MoMSxzaXplb2YoTm9kZSkpOwogICAgbmV3X2l0ZW0tPmRhdGEgPSBpbjsKICAgIHJldHVybiBuZXdfaXRlbTsKfQoKdm9pZCByZWFkX2xpc3QoTm9kZSAqKmhlYWQpewogICAgaWYoKmhlYWQgPT0gTlVMTCkKICAgICAgICAqaGVhZCA9IHJlYWRfaXRlbSgpOwoKICAgIE5vZGUgKiBsYXN0X2l0ZW0gPSAqaGVhZDsKICAgIE5vZGUgKiBpdGVtID0gTlVMTDsKICAgIHdoaWxlKChpdGVtID0gcmVhZF9pdGVtKCkpKXsKICAgICAgICBsYXN0X2l0ZW0tPm5leHQgPSBpdGVtOwogICAgICAgIGxhc3RfaXRlbSA9IGl0ZW07CiAgICB9Cn0KCnZvaWQgcHJpbnQoTm9kZSAqaGVhZCl7CiAgICBOb2RlICpwOwogICAgcC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