semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct stu
{   char num[20];
     char name[30];
     char sex;
     int age;
     float score;
     char add[30];
     struct stu *next;
     };
void main()
{ int i,len=1;
 struct stu *p1,*p2,*head,*new,*newhead;
 p1=p2=head=(struct stu*)malloc(sizeof(struct stu));
 printf("\n");
 scanf("%s %s %c %d %f %s" ,p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
 while(strcmp(p1->num,"end")!=0)
 {p1=(struct stu*)malloc(sizeof(struct stu));
  scanf("%s %s %c %d %f %s" ,p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
  printf("\n");
  if(strcmp(p1->num,"end")==0)
  p2->next=NULL;
  else
  {p2->next=p1;
  p2=p1;
  len++;}
 }
 p1=head;
 for(i=0;i<len;i++)
 { p1=p2=head;
 while(p1->next!=NULL)
   {p2=p1;
   p1=p1->next;
   }
   if(i==0)
   newhead=new=p1;
   else
   new=new->next=p1;
   p2->next=NULL;
}
p1=newhead;
for(i=0;i<len;i++)
{printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
}
struct student
{
	char a[100];
	struct student *next;
};

struct student *create()
{
	struct student *p1,*p2;

	p1=(struct student*)malloc(len);
	gets(p1->a);
	p1->next=NULL;

	p2=p1;
	for(;;)
	{
		p1=(struct student*)malloc(len);
		gets(p1->a);
		if(strcmp(p1->a,"end")==0) 
		{
			free(p1);
			break;
		}
		p1->next=p2;
		p2=p1;
	}
	return p2;
}

void main()
{
	struct student *head,*p1;
	struct student *create();
	head=create();
	p1=head;
	while(p1)
	{
		printf("%s\n",p1->a);
		p1=p1->next;
	}
}
struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char address[20];
	struct student*next;
};

char t[4]={"end"};
struct student*p1,*p2;
struct student * creat(void)   //???????
{ 
	struct student*head;
    int	n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s", p1->num);
	while ( strcmp(p1->num,t)!=0) 
	{
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
		n=n+1;
		if(n==1) 
		{
			head = p1;
		}
		else
		{
			p2->next=p1;
		}
		p2=p1;		
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
	}
	p2->next = NULL;
	return(head);
}         


struct student*order(struct student*head) //???????
{
	struct student*ben,*rehead=NULL;
    while(head->next!=NULL)
	{
		p2=NULL;
		p1=head;
		while(p1->next!=NULL)
		{
			p2=p1;
			p1=p1->next;
		}
		if(rehead==NULL)
		{
			rehead=p1;
			ben=rehead->next=p2;
		}
			ben=ben->next=p2;
			p2->next=NULL;
	};
	return(rehead);
}

void print(struct student*head)  //???????
{
	struct student*p;
	p=head;
	if(head!=NULL)
	do
	{
    printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
	p=p->next;
	}while(p!=NULL);
}

int main()
{
	struct student*head;
	head=creat();
	head=order(head);
	print(head);
    return 0;
}
struct stu
{char num[50];
  char name[50];
  char sex[1];
  int age; 
  char score[50];
  char add[50];
  struct stu *next;
};
int main()
{struct stu *head,*p1,*p2;
 p1=(struct stu*)malloc(LN);
 scanf("%s",p1->num);
 scanf("%s",p1->name);
 scanf("%s",p1->sex);
 scanf("%d",&p1->age);
 scanf("%s",p1->score);
 scanf("%s", p1->add);
 p1->next=NULL;
 p2=p1;head=p1;
  do
  { p1=(struct stu*)malloc(LN);
    scanf("%s",p1->num);
    if(*(p1->num)=='e')
    {free(p1);head=p2;break;}
     else
     {
  scanf("%s",p1->name);
  scanf("%s",p1->sex);
  scanf("%d",&p1->age);
  scanf("%s",p1->score);
  scanf("%s", p1->add);
    p1->next=p2;
    p2=p1;
     }       
}while(1);
  while(head)
  {printf("%s %s %c %d %s %s\n",head->num,head->name,*(head->sex),head->age,head->score,head->add);
    head=head->next;
  }
}
struct student
{char information[100];
 struct student *next;
};
int n;
struct student *creat(void)
{struct student *head;
 struct student *p1,*p2;
 n=0;
 p1=p2=(struct student *)malloc(LEN);
 gets(p1->information);
 while(strcmp(p1->information,"end")!=0)
 {n=n+1;
  if(n==1) p1->next=NULL;
  else {p1->next=p2;p2=p1;}
  p1=(struct student *)malloc(LEN);
  gets(p1->information);
 }
 head=p2;
 return(head);
}
void print(struct student *p)
{
	do
	{
		printf("%s\n",p->information);
		p=p->next;
	}while(p!=NULL);
}
void main()
{
	struct student *head;
	head=creat();
	print(head);
}
main()
{
	struct stu
	{
	    char num[10];
    	char name[32];
     	char sex;
    	int age;
    	float score;
    	char address[32];
     	struct stu *next;
	};
	struct stu *p1,*p2;
	p1=(struct stu *)malloc(len);
	p1->next=NULL;
	int i;
	for(i=0;;i++)
	{
		scanf("%s",p1->num);
		if(!strcmp(p1->num,"end"))
			break;
    	scanf("%s %c %d %g %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
		p2=(struct stu *)malloc(len);
        p2->next=p1;
		p1=p2;
	}
	p1=p1->next;
	while(p1)
	{
		printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
		p1=p1->next;
	}
}
struct student
{ 
	char temp[50];
	struct student *previous;
};
void main()
{
	struct student *end,*head;
	struct student *p1,*p2, *p;
/*p1=(struct student *)malloc(LEN);*/
	p2=head=NULL;
	while(1)
	{
		p1=(struct student*)malloc(LEN);
		gets(p1->temp);
		if (strcmp(p1->temp,"end")==0)
		{
				/*delete p1;*/
			break;
		}
 
		if(head==NULL) {
			head=p1;
			head->previous=NULL;
		}
		else 
			p1->previous=p2;
		p2=p1;
	}
/*p1->previous=p2;*/
	p=p2;
	if(p!=NULL)
		while(p) {
			puts(p->temp);
			p=p->previous;
		}

}
void main()
{
	struct li
	{
		char num[20],k[1000];
		struct li *next,*up;
	}*head,*p;
	head=(struct li *)malloc(sizeof(struct li));
	p=head;
	for(;;)
	{
		scanf("%s",p->num);
		if(p->num[0]=='e')
			break;
		gets(p->k);
		p->next=(struct li *)malloc(sizeof(struct li));
		(p->next)->up=p;
		p=p->next;
	}
	p=p->up;
	while(p!=head)
	{
		printf("%s%s\n",p->num,p->k);
		p=p->up;
	}
	printf("%s%s\n",head->num,head->k);

}
struct student
{
	char information[100];
	struct student *previous;
};

void main()
{
	struct student *p1,*p2,*p;
	p1=z;
	p1->previous=NULL;
	gets(p1->information);
	do{
		p2=z;//???p1,p2??????????????
		p2->previous=p1;
		p1=p2;
     	gets(p2->information);
	} while(strcmp(p1->information,"end"));
	p1=p1->previous;
	for(p=p1;p;p=p->previous)
	    puts(p->information);
}
struct student{
	struct student * formal;
	char xuehao[20];
	char xingming[20];
	char xingbie;
	int nianling;
	char defen[20];
	char dizhi[30];
	struct student * next;
};        
int n=0;    
struct student * creat(void);
void print(struct student *end);

void main()
{
	struct student * enda;
	enda=creat();
	print(enda);
	return 0;
}

struct student * creat(void)
{
	struct student * end;       
	struct student *p1,*p2;     
	n=0;
	p1=p2=(struct student *)malloc(LEN);      
	scanf("%s",p1->xuehao);    
	while(p1->xuehao[0]!='e')
	{
		scanf("%s %c %d%s%s",p1->xingming,&p1->xingbie,&p1->nianling,p1->defen,p1->dizhi);
		n=n+1;      
		if(n==1)
		{
			p1->formal=NULL;
		}
		else
		{
			p2->next=p1;
			p1->formal=p2;
		}
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->xuehao);
	}
	p2->next=NULL;
	end=p2;   
	return(end);
}

void print(struct student *end)
{
	struct student *p;
	p=end;
	if(end!=NULL)
	{
		do
		{
	    printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->defen,p->dizhi);
		p=p->formal;
		}while(p!=NULL);
	}
}
// 1209.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
struct data
{
	char num[200],name[200],sex,add[200];
	int age;
	char score[200];
	struct data *next;
};

struct data *creat()
{
	struct data *head,*p1 = NULL,*p2 = NULL;
	int n=0;
	do{
		p2=p1;
		p1=(struct data*)malloc(sizeof(struct data));
		scanf("%s",p1->num);
		if(*p1->num=='e')
		{
			head=p2;
			free(p1);
			break;
		}
		scanf("%s %c %d %s %s\n",p1->name,&(p1->sex),&(p1->age),p1->score,p1->add);
		
		if(n==0) p1->next=NULL;
		if(n!=0) p1->next=p2;
		n=1;
	}
	while(1);
	return head;
}
void print(struct data *head)
{
	struct data *p;
	p=head;
	while(p)
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
		p=p->next;
	}
}

int main()
{
	struct data *head;
	head=creat();
	print(head);
	return 0;
}
struct q
{
	char a[100];
	struct q *last;
};
struct q * c()
{
	struct q *p1,*p2,*end;
	int t=1;
	while(0==0)
	{
		p1=(struct q *)malloc(sizeof(struct q));
		gets(p1->a);
		if(t==1)
		{
			p1->last=NULL;
			p2=p1;
			t=0;
		}
		else
		{
			if(p1->a[0]!='e')
			{
				p1->last=p2;
				p2=p1;
			}
			else
			{
				end=p2;
				break;
			}
		}
	}
	return end;
}
main()
{
	struct q *p1;
	p1=c();
	while(p1!=NULL)
	{
		puts(p1->a);
		p1=p1->last;
	}
}
int main()
{
	int i,m;
	char a[501][500];
	for(i=0;;i++)
	{
		gets(a[i]);
		if (a[i][0]=='e')
		{
			m=i;
			break;
		}
	}
	for(i=m-1;i>=0;i--)
	{
		puts(a[i]);
	}
	return 0;
}
struct student
{
	char a[100];
	struct student * next;
}*p1,*p2,*head;

int main()
{
	int n=0;
	p1=p2=(struct student *)malloc(Len);
	gets(p1->a);
	p2->next=NULL;
	while(1)
	{
		p1=(struct student *)malloc(Len);
		gets(p1->a);
		p1->next=p2;
		if(strcmp(p1->a,"end")==0)
		{
			head=p1->next;
			break;
		}
		else
		{
			p2=p1;
		}

	}
	p1=head;
	while(p1)
	{
		printf("%s\n",p1->a);
		p1=p1->next;
	}

	
}
struct student
{
	char num[10];
	char name[20];
	char sex;
	int age;
	char score[20];
	char address[50];
    struct student *next;
};
void main()
{
	struct student *head,*p,*q,*t;
	t=(struct student*)malloc(sizeof(struct student));
	t->next=NULL;
	head=(struct student*)malloc(sizeof(struct student));
	head->next=NULL;
	int i;
	for(i=0;;i++)
	{
		p=head->next;
		q=(struct student*)malloc(sizeof(struct student));
		q->next=NULL;
		scanf("%s",q->num);
        if(q->num[0]=='e')
			break;
		scanf("%s %c %d %s %s",q->name,&q->sex,&q->age,q->score,q->address);
		t->next=p;
		head->next=q;
		q->next=p;
	}
	head->next=p;
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}
}
struct stu
{
	char zifu[200];
	struct stu *next;
};
struct stu stu[1000];
void main()
{   int i;
	struct stu *p=stu;
	for(i=0;i<1000;i++,p++)
	{
		gets(p->zifu);
		char str[10]="end";
		if((strcmp(p->zifu,str))==0)
			break;
		p->next=(p-1);
	}
	p=p-1;
	stu[0].next=NULL;
	while(p!=NULL)
	{
		puts(p->zifu);
		p=p->next;
	}
}
struct student
{
	char num[10];
	char name[20];
	char sex[2];
	int age;
	char score[30];
	char add[30];
	struct student *next;
};

int main()
{	struct student *head;
	struct student *p1,*p2,*p;	
	p2=p=(struct student*)malloc(sizeof(struct student));
	scanf("%s%s%s%d%s%s",p2->num,p2->name,p2->sex,&p2->age,p2->score,p2->add);
	p2->next=NULL;
 	do
	{	
		p2=(struct student*)malloc(sizeof(struct student));
		scanf("%s",p2->num);
		if(strcmp(p2->num,"end")==0)
			break;
		scanf("%s%s%d%s%s",p2->name,p2->sex,&p2->age,&p2->score,p2->add);
		p2->next=p;
		p=p2;
		
	}
	while(strcmp(p2->num,"end")!=0);
	head=p;
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
	}
	return 0;
}
struct stu
{
	char num[21];
	char name[21];
	char sex;
	int age;
	char score[11];
	char addr[21];
	struct stu *pre,*next;
}head,end;

void create()
{
	struct stu *p1,*p2;
	p2=&head;
	p1=(struct stu *)malloc(sizeof(struct stu));
	scanf("%s",p1->num);
	while (strcmp(p1->num,"end")!=0)
	{
		p2->next=p1;
		p1->pre=p2;
		scanf("%s",p1->name);
		scanf(" %c",&p1->sex);
		scanf("%d",&p1->age);
		scanf("%s",p1->score);
		scanf("%s",p1->addr);
		p2=p1;
		p1=(struct stu *)malloc(sizeof(struct stu));
		scanf("%s",p1->num);
	}
	p2->next=&end;
	end.pre=p2;
}
void anti_print()
{
	struct stu *p;
	int flag=0;
	p=end.pre;
	while (p!=&head)
	{
		if (flag) printf("\n");

		printf("%s",p->num);
		printf(" %s",p->name);
		printf(" %c",p->sex);
		printf(" %d",p->age);
		printf(" %s",p->score);
		printf(" %s",p->addr);
		p=p->pre;

		flag=1;
	}
}
void main()
{
	head.pre=NULL;
	end.next=NULL;
	create();
	anti_print();
}
//???????
struct student
{       char info[50];
        struct student *next;
}*p1,*p2;
int n;
//????
struct student *creat (void)
{
        struct student *head;
        n=0;
        p1=p2=(struct student*)malloc(LEN);
        gets(p1->info);
        head = NULL;
        while(strcmp(p1->info,"end"))
        {
               n = n+1;
               if(n==1)
                       head = p1;
               else
                       p2->next = p1;
               p2 = p1;
               p1 = (struct student*)malloc(LEN);
               gets(p1->info);
        }
        p2->next = NULL;
        return(head);
}
struct student *turnback(struct student *head)
{
        struct student *p,*newhead=NULL;
        do
        {
               p2=NULL;
               p1=head;
               while(p1->next!=NULL)
               {
                       p2=p1;
                       p1=p1->next ;
               }
               if(newhead==NULL)
               {
                       newhead=p1;
                       p=newhead->next=p2;
               }
               p=p->next=p2;
               p2->next=NULL;
        }while(head->next!=NULL);
        return(newhead);
}
void output(struct student *outhead)
{
        for(p1=outhead;p1!=NULL;p1=p1->next)
               puts(p1->info);
}

void main()
{
        struct student *head;
        head=creat();
        head=turnback(head);
        output(head);
        printf("\n");
}
struct student
{
	char number[15];
	char name[20];
	char gender[3];
	int age;
	float score;
	char address[30];
	struct student *next;
};
struct student *creat(void)
{
	int i=1;
	struct student *head,*p1=(struct student *)malloc(LEN);
	head=p1;
	head->next=NULL;
	scanf("%s%s%s%d%f%s",p1->number,p1->name,p1->gender,&p1->age,&p1->score,p1->address);
	while(1)
	{
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->number);
		if((i=strcmp(p1->number,"end"))==0)break;
		scanf("%s%s%d%f%s",p1->name,p1->gender,&p1->age,&p1->score,p1->address);
		p1->next=head;
		head=p1;
	}
	return(head);
}
void print(struct student *p)
{
	do{printf("%s %s %s %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);p=p->next;}while(p->next!=NULL);
	printf("%s %s %s %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
}
void main()
{
	struct student *p=creat();
	print(p);
}
void main()
{
char s[1024][128];
int i=0;

while(gets(s[i]))
{
if(strcmp(s[i],"end")==0) break;
i++;
}

while(i!=0)
{
i--;
puts(s[i]);
}
}
struct student{
char num[20];
char name[20];
char sex;
int age;
float score;
char address[20];
struct student *next;
};
int n;
struct student *create()
{
	struct student *head;
	struct student *p1,*p2;
	head=NULL;
	n=0;
	p1=p2=(struct student *)malloc(len);
	scanf("%s",p1->num);
	if(p1->num[0]=='e')
            return(head);
    scanf("%s %c %d%f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
	//printf("%s %s %c %d%d %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
	while(n!=-1)
	{
		n++;
		if(n==1)
			p1->next=NULL;
		else
			p1->next=p2;
		p2=p1;
		p1=(struct student *)malloc(len);
		scanf("%s",p1->num);
		if(p1->num[0]=='e')
            break;
		scanf("%s %c %d%f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
		//printf("%s %s %c %d%d %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
	}
	head=p2;
	return(head);
}
void print(struct student *p)
{
	while(p!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}
}
void main()
{
	struct student *p;
	p=create();
	print(p);
}
struct student
{char num[20];
char name[20];
char sex[2];
int old;
float grade;
char address[100];
struct student *next;
};
int main()
{
	struct student *p1,*p2;
	p1=p2=NULL;
	p1=(struct student *)malloc(sizeof(struct student));
	scanf("%s",p1->num);
    if(p1->num[0]=='e')
		return 0;
do
	{	

		scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->old,&p1->grade,p1->address);
		p1->next=p2;
		p2=p1;
		p1=(struct student *)malloc(sizeof(struct student));
		p1->next=p2;
scanf("%s",p1->num);

	}	while(p1->num[0]!='e');
	
	while(p2!=NULL)
	{
		printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->old,p2->grade,p2->address);
		p1=p2->next;
		p2=p1;
	}

	return 0;

}
struct stu
{char num[20];
 char name[20];
 char sex;
 int age;
 char score[10];
 char adr[20];
 struct stu *next;
};
int main(){
int n=0;
int i;
	struct stu *head;
    struct stu *p1,*p2,*re,*rehead;

	p1=p2=(struct stu *)malloc(len);
	scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
	head=null;
	
	for(i=0;;i++){
	

		n++;
		if(n==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		
		p1=(struct stu *)malloc(len);	
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")==0){
				break;}
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
	}
	p2->next=null;
/*	p1=head;
	while(p1!=null){
			printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->adr);
			p1=p1->next;
		}*/
	for(i=0;i<n;i++){
		p2=p1=head;
		while(p1->next!=null){
			p2=p1;
			p1=p1->next;
		}
		if(i==0)
			re=rehead=p1;
		else
			re=re->next=p1;
		p2->next=null;
	}
		p1=rehead;
	while(p1!=null){
			printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->adr);
			p1=p1->next;
	}

	return 0;
}
struct student
{
	char num[100];
	char name[100];
	char sex;
	int age;
	float score;
	char add[100];
	struct student *next;
};
int n;
struct student*input(void)
{
	struct student *head,*p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf ("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
	p1->next=NULL;
	head=NULL;
	while (strcmp("end",p1->num)!=0)
	{
		
		n++;
		p2=(struct student*)malloc(LEN);
		p2->next=p1;
		p1=p2;
		scanf ("%s",&p1->num);
		if (strcmp("end",p1->num)==0) break;
		else scanf ("%s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
	}
	head=p1->next;
	return (head);
}
void main ()
{
	struct student *p;
	p=input();
	while (p!=NULL)
	{
		printf ("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
		p=p->next;
	}
}
struct student
{  char id[100];
   char name[100];
   char sex;
   int age;
   char score[100];
   char adress[100];
   struct student *next;
   struct student *formal;
};
int n;
int main ()
{  struct student *head,*p1,*p2;
   n=0;
   int i=0;
   p1=p2=(struct student*)malloc(len);
   head=NULL;
   while(0==0)
   {   n=n+1;
       
   scanf("%s ",p1->id);
   if((*p1).id[0]=='e') break;
   scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,
   p1->adress);  
   if(n==1) {head=p1;
   p1->formal=NULL;}
   else {p2->next=p1;
   p1->formal=p2;}
   p2=p1; 
       p1=(struct student*) malloc(len);
   
   }
    p2->next=NULL;
   while (0==0)
   {  printf("%s %s %c %d %s %s\n",p2->id,p2->name,p2->sex,p2->age,p2->score,
   p2->adress);
   if(p2->formal==NULL) break;
   p2=p2->formal;
   }  
   return 0;
}
struct stu
{
	char xuehao[100];
	
	struct stu*next;
};
void main()
{
	int n=0;
	struct stu *head=NULL,*p1=NULL,*p2=NULL;
	p1=p2=(struct stu*)malloc(LEN);
    gets(p1->xuehao);
	
	while(strcmp(p1->xuehao,"end")!=0)
	{
		
		
		n++;
		if(n==1)
		{
			
			p1->next=NULL;
		}
		else 
		
			p1->next=p2;
			p2=p1;
		    p1=(struct stu*)malloc(LEN);
			gets(p1->xuehao);
		
	
	}
	while(p2->next!=NULL)
	{
		printf("%s\n",p2->xuehao);
		p2=p2->next;
	}
    printf("%s\n",p2->xuehao);
	
}
struct student
{
	char info[50];
	struct student *pre;
	struct student *next;
};

void main()
{
	int i=0,n=0;
	struct student *p,*head,*p0;
	p=head=(struct student *)malloc(sizeof(struct student));
	while(strcmp((gets((*p).info)),"end")!=0)
	{
		n+=1;
		p0=p;
		p=(*p).next=(struct student *)malloc(sizeof(struct student));
		(*p).pre=p0;
	}

	while(i++<n)
	{
		p=(*p).pre;
		printf("%s\n",(*p).info);
	}
}
struct student 
{
	struct student *next;
	char a[100];
};
int n;
struct student *creat()
{
	struct student *p1,*p2,*head;
	n=0;
	p1=(struct student *)malloc(sizeof(struct student ));
	gets(p1->a);
	p2=p1;
	head=NULL;
	while (strcmp(p1->a,"end")!=0)
	{
		n=n+1;
		if(n==1)
			head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(sizeof(struct student ));
		gets(p1->a);
	}
	p2->next=NULL;
	return(head);
}
/*void main()
{
	struct student *p,*head;
	head=creat();
	p=head;
	while(p!=NULL)
	{
		printf("%s\n",p->a);
		p=p->next;
	}

}*/
void main()
{
    struct student *p1,*head,*p2;
	head=creat();
	p1=head;
	
	while(1)
	{
		
		if(p1->next!=NULL) {p2=p1;p1=p1->next;}
		if(p1->next==NULL&&p2!=head)
		{
			
			printf("%s\n",p1->a);
			p2->next=NULL;
			p1=head;
		}
		if(p1->next==NULL&&p2==head) break;
		

	}
	printf("%s\n%s",p1->a,head->a);
}
struct student
{
	char num[30];
	char name[20];
	char a[3];
	int age;
	char score[10];
	char add[30];
	struct student *next;
};
int n;
void *malloc(unsigned int size);
void main()
{
	int l=0,i=0;
    struct student *head,*p1,*p2,*newhead,*new1;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s%s%s%d%s%s",&p1->num,&p1->name,&p1->a,&p1->age,&p1->score,&p1->add);
	head=NULL;
	while(strcmp(p1->num,"end")!=0)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s%s%s%d%s%s",&p1->num,&p1->name,&p1->a,&p1->age,&p1->score,&p1->add);
	}
	p2->next=NULL;
    for(i=0;i<n;i++)
	{
		p2=p1=head;
        while(p1->next!=NULL)
		{
             p2=p1;
	       	p1=p1->next;
		}
		if(i==0)
			newhead=new1=p1;
		else new1=new1->next=p1;
		p2->next=NULL;
	}
    p1=newhead;
	for(l=0;l<n;l++)
	{
		printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->a,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
}
int main()
{
	struct student{
		char number[20];
		char name[20];
		char sex;
		int age;
		float score;
		char address[20];
		struct student *fomer;
		struct student *next;
	};
	struct student *head,*p,*wei;
	int i,j;
	head=(struct student *)malloc(sizeof(struct student));
	p=head;
	p->fomer=NULL;
	if (p==NULL)
		{
			printf("fail!!!");
			exit(-1);
		}
	scanf("%s%s %c %d%f%s",&p->number,&p->name,&p->sex,&p->age,&p->score,&p->address);
	for (i=1;i<=1000;i++)
	{
		p->next=(struct student *)malloc(sizeof(struct student));
		p->next->fomer=p;
		p=p->next;
		scanf("%s%s %c %d%g%s",&p->number,&p->name,&p->sex,&p->age,&p->score,&p->address);
		//printf("%s %s %c %d %g %seeererrtttre\n",p->fomer->number,p->fomer->name,p->fomer->sex,p->fomer->age,p->fomer->score,p->fomer->address);
		if (*p->number=='e')
		{
			p->fomer->next=NULL;
			wei=p->fomer;
			//printf("%s %s %c %d %g %s\n",wei->number,wei->name,wei->sex,wei->age,wei->score,wei->address);
			break;
		}
	}
	//printf("%s %s %c %d %g %s\n",wei->number,wei->name,wei->sex,wei->age,wei->score,wei->address);
	p=wei;
	for (;p!=NULL;)
	{
	   printf("%s %s %c %d %g %s\n",p->number,p->name,p->sex,p->age,p->score,p->address);
	   p=p->fomer;
	}
	

}
void main()
{struct student
{char a[100];
 struct student *next;
} *p1,*p2,*head;
int n=0;
p1=p2=(struct student *)malloc(sizeof(struct student));
head=NULL;
gets(p1->a);
while(strcmp(p1->a,"end"))
{n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->a);
}
p2->next=NULL;
for(;;)
{ for(p2=head;;p2=p2->next)
  { p1=p2->next;
	  if(p1->next==NULL)
	  {printf("%s\n",p1->a);
        p2->next=NULL;
		break;
	  }
  }
if(p2==head)
{printf("%s\n",head->a);
break;
}

}



}
struct stu
{char num[20];
 char name[20];
 char sex;
 int age;
 char score[10];
 char add[20];
 struct stu *next;};

void main()
{
	struct stu *p1,*p2;
	int n=0;
	p1=p2=(struct stu*)malloc(LEN);
	scanf("%s",p1->num);
	if(strcmp(p1->num,"end")==0) {n=-1;p2=NULL;}
	else scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
	while(n>=0)
	{n+=1;
     if(n==1)p1->next=NULL;
	 else p1->next=p2;
	 p2=p1;
	 p1=(struct stu*)malloc(LEN);
	 scanf("%s",p1->num);
	 if(strcmp(p1->num,"end")==0)break;
	 scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);}
    while(p2!=NULL)
	{printf(A,p2->num,p2->name,p2->sex,p2->age,p2->score,p2->add);
	p2=p2->next;}
}