#include <stdio.h>
#include <stdlib.h>
#include<string.h>
typedef struct stu{
int data;
struct stu *next;
}s,*link;
void output(link h)
{
s *p;
p=h->next;
while(p!=NULL)
{
printf("%d ",p->data);
p=p->next;
}
printf("\n");
}
void creat(link h)
{
s *pre;
pre=h;
while(pre->next!=NULL)
{
if((pre->next->data)%2==0)
{
pre->next=pre->next->next;//此时尾指针不可再向前移动,若移动则无法判断当前节点是否为偶数,前几次因为移动指针而出错
}
else
{
pre=pre->next;
}
}
}
int main()
{
int x;
link h;
s *r,*p;
h=(s*)malloc(sizeof(s));
h->next=NULL;
r=h;
while(scanf("%d",&x)!=EOF&&x)
{
p=(s*)malloc(sizeof(s));
p->data=x;
r->next=p;
r=p;
}
r->next=NULL;
creat(h);
output(h);
return 0;
}