#include <stdio.h>
#include <stdlib.h>
/* 伪双向链表 */
typedef struct _data{
int value;
struct _data *next;//前指向
struct _data *back;//后指向
} Data;
typedef struct _list{
Data *head;//头结点
Data *tail;//尾结点
} List;
void creat_link(List *pList, int x,int cnt);
void reverse_link(List *pList);
int main(){
List list;
list.head = list.tail = NULL;
int x;
int cnt = 0;
while(x != -1){
scanf("%d", &x);
creat_link(&list, x, cnt);
cnt++;
}
reverse_link(&list);
Data *p;
Data *q;
for (p = list.head; p;p=p->next){
free(p->back);
}
return 0;
}
/* 创建链表 */
void creat_link(List *pList, int x,int cnt){
if ( x != -1){
if (cnt == 0){//第一次创建结点
Data *p = (Data *)malloc(sizeof(Data));
p->value = x;
p->next = NULL;
p->back = NULL;
pList->head = p;
pList->tail = pList->head;
}
if (cnt