semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct stu
{
	char num[15];
	char name[20];
	char sex;
	int age;
	char score[10];
	char addr[15];
	struct stu* next;
};
int main()
{
	struct stu* p1,*p2;
	p1=(struct stu*)malloc(len);
	scanf("%s%s %c%d%s%s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
	p1->next=NULL;
	while(1)
	{
		p2=(struct stu*)malloc(len);
		scanf("%s",p2->num);
		if(p2->num[0]=='e')
			break;
        scanf("%s %c%d%s%s",p2->name,&p2->sex,&p2->age,p2->score,p2->addr);
		p2->next=p1;
		p1=p2;
	}
	while(p1!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
		p1=p1->next;
	}	
	return 0;
}
struct stu
{
	char a[1000];
	struct stu *next;
};
void main()
{
	struct stu *head,*p1,*p2;
	p1=p2=(struct stu*)malloc(LEN);
	head=p1;
	p1->next=NULL;
	gets(p1->a);
	while (strcmp(p1->a,"end")!=0)
	{
			p1=(struct stu*)malloc(LEN);
			gets(p1->a);
			head=p1;
			p1->next=p2;
			p2=p1;
	}
	p1=head->next;
	while (p1!=NULL)
	{
		puts(p1->a);
		p1=p1->next;
	}
}
typedef struct student
{
	char num[20];
	char name[20];
	char sex[2];
	char age[3];
	char mark[10];
	char add[30];
	struct student *next;
} stu;
int n;
stu* rcreate()
{
	stu *head,*p;
	head=p=(stu*)malloc(LEN);
	scanf("%s",p->num);
	p->next=NULL;
	if(strcmp(p->num,"end")==0)
	{
		head=NULL;
		return(NULL);
	}
	while(strcmp(p->num,"end")!=0)
	{
		scanf("%s %s %s %s %s",p->name,p->sex,p->age,p->mark,p->add);
		p=(stu*)malloc(LEN);
		p->next=head;
		head=p;
		scanf("%s",p->num);
	}
	head=p->next;
	free(p);
	return(head);
}
void print(stu* head)
{
	stu *p;
	p=head;
	if(p==NULL)
	{
		printf("list null!");
		return;
	}
	while(p->next!=NULL)
	{
		printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
		p=p->next;
	}
	printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
}
void main()
{
	stu *h;
	h=rcreate();
	print(h);
}
struct student
{
	char num[100];
	char name[100];
	char gender;
	int age;
	float score;       
	char add[100];
	struct student *next;
};
int n;
struct student *head=0;
struct student * creat(void)
{
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *) malloc(LEN);
	while(strcmp(p1->num,"end")!=0)
	{
		n++;
		if(n==1)
			p2->next=0;
		else p1->next=p2;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")!=0)
		scanf("%s %c %d %f %s",p1->name,&p1->gender,&p1->age,&p1->score,p1->add);
	}
	head=p2;
	return(head);
}
void main()
{
	struct student *p;
	p=creat();
	if(p!=0)     
		do
		{
			printf("%s %s %c %d %g %s",p->num,p->name,p->gender,p->age,p->score,p->add);
			p=p->next;
			if(p->next!=0)
				printf("\n");
		} while(p->next!=0);
}
struct S
{
	char xuehao[200];
	char xingming[200];
	char xingbie;
	int nianling;
	float defen;
	char dizhi[200];
	struct S *next;
};
int main()
{
	struct S *p1,*p2,*head;
	head=(struct S *)malloc(sizeof(struct S));
	p1=head;
	scanf("%s",p1->xuehao);
	head->next=NULL;
	while(p1->xuehao[0]!='e')
	{
		scanf("%s %c%d%f %s",p1->xingming,&p1->xingbie,&p1->nianling,&p1->defen,p1->dizhi);
		p2=(struct S*)malloc(sizeof(struct S));
		p2->next=p1;
		p1=p2;
		scanf("%s",p1->xuehao);
	}
	while(p1->next!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p1->next->xuehao,p1->next->xingming,p1->next->xingbie,p1->next->nianling,p1->next->defen,p1->next->dizhi);
		p1=p1->next;
	}
	return 0;
}
/*
 * tongjixueshengxinxi.cpp
 *
 *  Created on: 2011-12-18
 *      Author: 1100012857
 */
int main(void)
{
	struct student
	{
		char stunum[100];
		char stuname[20];
		char sex;
		int age;
		char score[20];
		char location[20];
		//struct student *next;
	}stu[990];
	int i;
	for(i=0;;i++)
	{
		cin>>stu[i].stunum;
		if(stu[i].stunum[0]=='e')
			break;
		cin>>stu[i].stuname>>stu[i].sex>>stu[i].age>>stu[i].score>>stu[i].location;

	}
	i--;
	int n=i;
	for(i=n;i>=0;i--)
	{
		cout<<stu[i].stunum<<' '<<stu[i].stuname<<' '<<stu[i].sex<<' '<<stu[i].age<<' '<<stu[i].score<<' '<<stu[i].location<<endl;
	}
	return 0;
}
struct student
{
	char num[10];
	char name[20];
	char sex;
	int age;
	char score[10];
	char add[15];
	struct student *next;
};
void main()
{
	struct student *p1,*p2,*head;
	int n=0;
	p1=p2=(struct student*)malloc(LEN);
	p1->next=NULL;
	scanf("%s",p1->num);
	while(strcmp(p1->num,"end")!=0)
	{
		scanf("%s %c %d %s %s\n",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
		n++;
		p2=(struct student*)malloc(LEN);
		p2->next=p1;
		p1=p2;
		scanf("%s",p1->num);
	}
	head=p1->next;
	p1=head;
	while(p1->next!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
	printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}
struct student
{
    char con[50];
    struct student *next;
};
int n;
 
struct student *creat(void)
{
    struct student *head,*p,*q;
    n=0;
    p=q=(struct student *)malloc(len);
	gets(p->con);
    head=null;
    while(strcmp(p->con,"end")!=0)
    {
        //scanf("%s %c %d %d %s",p->name,&p->gender,&p->age,&p->score,p->add);
        n++;
        if(n==1)head=p,p->next=null;
        else head=p,p->next=q;
        q=p;
        p=(struct student *)malloc(len);
		gets(p->con);
    }
    return(head);
}
 
void print(struct student *head)
{
    struct student *p;
    p=head;
    int i;
    for(i=0;i<n;i++)
    {
		printf("%s\n",p->con);
        p=p->next;
    }
}
 
void main()
{
    struct student *head;
    head=creat();
    print(head);
}
struct student
	{
		char number[30];
		char name[30];
		char gender;
		int age;
		char score[30];
		char add[30];
	};
int main()
{
	
	int lengthofnumber[505]={0},lengthofname[505]={0},lengthofadd[505]={0},lengthofscore[505]={0};
	int i,j,numberofstudent=0;
	struct student stu[505];
	for(i=0;i<505;i++)
	{//read
		for(j=0;j<30;j++)
		{//number
			scanf("%c",&stu[i].number[j]);
			if(stu[i].number[j]==' '||stu[i].number[j]=='d')
			{
				break;
			}
			else
			{
				lengthofnumber[i]+=1;
			}
		}//number
		if(stu[i].number[2]=='d')
		{
			break;
		}
		else
		{
			numberofstudent+=1;
		}
		for(j=0;j<30;j++)
		{//name
			scanf("%c",&stu[i].name[j]);
			if(stu[i].name[j]==' ')
			{
				break;
			}
			else
			{
				lengthofname[i]+=1;
			}
		}//name
		scanf("%c",&stu[i].gender);
		getchar();
		scanf("%d",&stu[i].age);
		getchar();
		for(j=0;j<30;j++)
		{//score
			scanf("%c",&stu[i].score[j]);
			if(stu[i].score[j]!=' ')
			{
				lengthofscore[i]+=1;
			}
			else
			{
				break;
			}
		}//score
		for(j=0;j<30;j++)
		{//add
			scanf("%c",&stu[i].add[j]);
			if(stu[i].add[j]!='\n')
			{
				lengthofadd[i]+=1;
			}
			else
			{
				break;
			}
		}//add
		
	}//read
			i=numberofstudent-1;
			while(i!=0)//for(i=numberofstudent-1;i==0;i--)
			{
				
				for(j=0;j<lengthofnumber[i];j++)
				{
					printf("%c",stu[i].number[j]);
				}
				printf(" ");
				for(j=0;j<lengthofname[i];j++)
				{
					printf("%c",stu[i].name[j]);
				}
				printf(" ");
				printf("%c ",stu[i].gender);
				printf("%d ",stu[i].age);
				for(j=0;j<lengthofscore[i];j++)
				{
					printf("%c",stu[i].score[j]);
				}
				printf(" ");
				for(j=0;j<lengthofadd[i];j++)
				{
					printf("%c",stu[i].add[j]);
				}
				printf("\n");
				i--;
			}
	
			for(j=0;j<lengthofnumber[0];j++)
			{
				printf("%c",stu[0].number[j]);
			}
			printf(" ");
			for(j=0;j<lengthofname[0];j++)
			{
				printf("%c",stu[0].name[j]);
			}
			printf(" ");
			printf("%c ",stu[0].gender);
			printf("%d ",stu[0].age);
			for(j=0;j<lengthofscore[0];j++)
				{
					printf("%c",stu[0].score[j]);
				}
			printf(" ");
			for(j=0;j<lengthofadd[0];j++)
			{
				printf("%c",stu[0].add[j]);
			}	
	return 0;
}
struct stu
{
	char num[20];
	char name[20];
	char s;
	int age;
	char point[10];
	char adr[50];
	struct stu *p;
};
void main()
{
	struct stu *stu1=NULL;
	int n=sizeof(struct stu);
	stu1=(struct stu *) malloc(n);
	struct stu *head=NULL,*curent=NULL;
	stu1->p=NULL;
	while(scanf("%s",stu1->num))
	{
		if((strcmp(stu1->num,"end"))==0)
			break;
		scanf("%s %c %d %s %s",stu1->name,&stu1->s,&stu1->age,&stu1->point,stu1->adr);
		stu1->p=curent;
		curent=stu1;
		stu1=(struct stu*) malloc(n);
	}
	while(curent!=NULL)
	{
		printf("%s %s %c %d %s %s\n",curent->num,curent->name,curent->s,curent->age,curent->point,curent->adr);
		curent=curent->p;
	}
}
struct student
{
       char num[20];
       char name[20];
       char ch[1];
       int ye;char gra[10];char add[20];
       struct student *next; 
};
int main()
{
    struct student *p,*p1,*p2;
    int n;
    p1=p2=(struct student*) malloc(LEN);
    scanf("%s",&p1->num);
    p=NULL;n=0;
    while (p1->num[0]!='e')    
    {
          scanf("%s%s%d%s%s",&p1->name,&p1->ch,&p1->ye,&p1->gra,&p1->add);
          n++;if (n==1) p2=p1;
          else p1->next=p2;
          p=p1;p2=p1;
          p1=(struct student *)malloc(LEN);
          scanf("%s",&p1->num);
    }
    if (p!=NULL)
    do
    {
      printf("%s %s %s %d %s %s\n",p->num,p->name,p->ch,p->ye,p->gra,p->add);
      p=p->next;     
                }while (p!=NULL);

}
struct student
{
	char num[9];
	char name[20];
	char sex;
	int age;
	float grade;
	char address[20];
	struct student *next;
};
void main()
{
	int n=1,i;
	struct student *thisnode,*newnode,*p;
    for(i=1;;i++)
	{
		newnode=(struct student *)malloc(LEN);	
		scanf("%s",newnode->num);	
		if(newnode->num[0]=='e')  break;
		scanf("%s %c %d %g %s",newnode->name,&newnode->sex,&newnode->age,&newnode->grade,newnode->address);
        if(n==1)
		{
			newnode->next=NULL;
			thisnode=newnode;
		}
		else
		{
			newnode->next=thisnode;
			thisnode=newnode;
		}
		n++;

	}

    p=thisnode;
	while(p!=NULL)
	{

		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
		p=p->next;
	}

}
struct st
{
    char id[200];
    struct st *pre;
    struct st *next;
} *p1, *p2;
int main(void)
{
    p1 = p2 = (struct st*)malloc(LEN);
    p1->pre = NULL;
    gets(p1->id);

    while(strcmp(p1->id,"end"))
    {
        p2->next=p1;
        p2=p1;
        p1=(struct st*)malloc(LEN);
        gets(p1->id);
        p1->pre=p2;
    }

    while(p2!=NULL)
    {
        printf("%s\n",p2->id);
        p2 = p2->pre;
    }

    return 0;
}
struct student
{
	char num[10];
	char qita[50];
	struct student *last;
};

void main()
{
	int l;
	struct student *end,*head,*p1,*p2;
	l=sizeof(struct student);
	end=(struct student*)malloc(l);
	head=(struct student*)malloc(l);
	scanf("%s",head->num);
	gets(head->qita);
	head->last=end;
	end->last=NULL;
	p1=head;
	p2=head;
	for(;;)
	{
		p1=(struct student*)malloc(l);
		scanf("%s",p1->num);
		if(p1->num[0]=='e')
			break;
		gets(p1->qita);
		p1->last=p2;
		p2=p1;
	}
	while(p2->last!=NULL)
	{
		printf("%s%s\n",p2->num,p2->qita);
		p2=p2->last;
	}
}
struct student
{
	char num[30];
	char name[50];
	char sex;
	int age;
	float score;
	char addr[100];
	struct student *next;
	struct student *pre;
};
int n;
struct student *end;
struct student *creat()
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(sizeof(struct student));
	scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr);
	head=0;
	p1->pre=0;
	for(;strcmp(p1->num,"end")!=0;)
	{
		n++;
		if(n==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(sizeof(struct student));
		p1->pre=p2;
		scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr);
	}
	p2->next=0;
	end=p2;
	return head;
}
void backprint(struct student *head,struct student *end)
{
	struct student *p;
	p=end;
	if(n==0)
	printf("1\n");
	else
	if(end!=0)
		for(;p!=0;)
		{
			printf("%s %s %c %d %g %s",p->num,p->name,p->sex,p->age,p->score,p->addr);
			printf("\n");
			p=p->pre;
		}
}
void main()
{
	struct student *head;
	head=creat();
	backprint(head,end);
}
struct student
{
 char num[50]; 
 char name[20];
 char sex;
 int year;
 char score[10]; 
 char add[50];
 struct student *next;
};

int n; 

struct student *Create()
{
 struct student *head; 
 struct student *p1=NULL; 
 struct student *p2=NULL; 
 n = 0; 
 p1 = (struct student *)malloc(LEN); 
 p2 = p1; 
 
  head = NULL;
   scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->year,p1->score,p1->add);
  
 int j=0;
 for(;;j++)
 {
  n += 1; 

  if (n==1) 
  {
   head = p1;

p2->next = NULL; 
  }
  else
  {
   p2->next = p1;
  }

  p2 = p1; 
  
  p1 = (struct student *)malloc(LEN);
  scanf("%s",p1->num);
  if(strcmp(p1->num,"end")==0) 
		{
			p2->next=NULL;
			break;
		}
  scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add);
 }
 
 p2->next = NULL; 
 
 free(p1); 
 p1 = NULL; 
 return head;
}
struct student *Reverse(struct student *head)
{
 struct student *p;
 struct student *p1; 
 struct student *p2;
 
 p1 = NULL;
 p2 = head; 
 while (p2 != NULL)
 {
  p = p2->next;
  p2->next = p1;
  p1 = p2;
  p2 = p;
 }
 head = p1;
 return head;
}


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->year,p->score,p->add);
   p = p->next; 
  }
  while (p != NULL);
 }
}

int main()
{
  struct student *head;
head = Create(); 
head = Reverse(head);
 Print(head);
	return 0;

}
struct student
{
	char a[100];
	struct student *next;
};
int n;

void main()
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(L);
	gets(p1->a);
	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(L);
		gets(p1->a);
	}
	p2->next=NULL;
	int i,k;
	struct student *j;
	j=head;
	for(k=n-1;k>-1;k--)
	{
		for(i=0;i<k;i++)
			j=j->next;
		puts(j->a);
		j=head;
	}
}
struct student
{
	char inf[200];
	struct student *prev;
};
struct student *creat()
{
	struct student *p1,*p2,*head;
	p1=p2=(struct student *)malloc(sizeof(struct student));
	gets(p1->inf);
	p1->prev=0;
	while(p1->inf[0]!='e')
	{
		p2=p1;
		p1=(struct student *)malloc(sizeof(struct student));
		gets(p1->inf);
		p1->prev=p2;
	}
	return(p2);
}
void print_f(struct student *head)
{
	struct student *p1;
	p1=head;
	while(p1!=0)
	{
		printf("%s\n",p1->inf);
		p1=p1->prev;
	}
}
void main()
{
	print_f(creat());
}
struct stu
{
	struct stu *next;
	char a[100];
};
void print(struct stu*p,int n)
{
	if(n>0)
	{
		printf("%s",p->a);
		printf("\n");
		print(p->next,n-1);
	}
}
int main()
{
	int n=1,i,m=100000;
	struct stu *p1,*p2;
	p1=(struct stu*)malloc(LEN);
	gets(p1->a);
		for(i=0;i<m;i++)
		{
			p2=(struct stu*)malloc(LEN);
			gets(p2->a);
			if(p2->a[0]!='e'&&p2->a[1]!='n'&&p2->a[2]!='d')
			{
				p2->next=p1;
				p1=p2;
				n+=1;
			}
			else
			{
				p2->next=p1;
				break;
			}
		}
		print(p2->next,n);
		return 0;
}
struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char add[20];
	struct student *next;
};
void main()
{
	struct student *p1,*p2;
		p1=p2=(struct student *)malloc(sizeof(struct student));
	p1->next=NULL;
	while(1)
	{
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")!=0)
		{
			scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
			p1=(struct student *)malloc(sizeof(struct student));
			p1->next=p2;
			p2=p1;
		}
		else
			break;
	}
	p1=p1->next;
	while(p1->next!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
	printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}
char a[]="end";

struct student
{
	struct student *last;
	char num[50];
	char name[50];
	char sex;
	int age;
	char grade[50];
	char address[50];
	struct student *next;
};

struct student *Appendnewnode()
{
	struct student *head=NULL, *newnode, *thisnode,*end;
	int i=0;
	do
	{
		newnode=(struct student *)malloc(sizeof(struct student));
		if(newnode==NULL)
		{
			printf("Memory request failed!");
			exit(-1);
		}
		scanf("%s",newnode->num);
		if(strcmp(newnode->num,a)!=0)
			scanf("%s %c %d %s %s",newnode->name,&newnode->sex,&newnode->age,&newnode->grade,newnode->address);
		if(i==0)
		{
			head=newnode;
			thisnode=head;
			newnode->last=NULL;
			if(strcmp(newnode->num,a)!=0)
				newnode->next=NULL;
			i++;
		}
		else
		{
			thisnode->next=newnode;
			newnode->last=thisnode;
			if(strcmp(newnode->num,a)!=0)
				thisnode=newnode;
		}
	}while(strcmp(newnode->num,a)!=0);
	end=thisnode;
	thisnode->next=NULL;
	return(end);
}

void main()
{
	struct student *end, *p;
	end=Appendnewnode();
	for(p=end;p->last!=NULL;p=p->last)
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
	printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
}
struct student
{
       char id[400];
       struct student *pre;
};
int main()
{
    int i=1,n=0;
    struct student a[1000],*head,*p;
    do
    {
                          gets(a[i].id);
                          i++;
                          n++;
    } while(a[i-1].id[0]!='e');
    head=&a[n-1];
    for(i=n-1;i>=2;i--)
    {a[i].pre=&a[i-1];}
    a[1].pre=NULL;
    p=head;
    for(i=1;i<=n-1;i++)
    {
                     puts(p->id);
                     p=p->pre;
    }
    return 0;
    
}
int n;

struct student
{char string[10000];
 struct student *next;
};

struct student *create(void)
{   
     struct student *tail,*p1,*p2,*head;

	 n=0;
	 p1=p2=(struct student *)malloc(Len);
	 gets(p1->string);
	 tail=NULL;

	 while(strcmp(p1->string,"end")!=0)
	 {
		 n=n+1;
		 if(n==1) 
		 {
			 tail=p1;
			 p1->next=NULL;
		 }
		 else
		 {
			 p1->next=p2;
		 }

		 p2=p1;
		 p1=(struct student *)malloc(Len); 
		 gets(p1->string);
	 }
	 head=p2;
	 return head;
}



void main()
{
	
	struct student *head,*p;
	head=create();

	p=head;
	
      do
        {
            puts(p->string);
            p=p->next;
        }
        while (p!=NULL);
    


	
}
struct student 
{
     char id[15];
     char name[20];
     char sex;
     int age;
     char grade[20];
     char add[20];
     struct student *next;
};
 
struct student *set(void)
{
     struct student *head,*p1,*p2;
     head=(struct student *)malloc(LEN);
     p1=head;
     p2=head;
     scanf("%s%s %c %d %s %s",head->id,head->name,&head->sex,&head->age,head->grade,head->add);
     p1=(struct student *)malloc(LEN);
     scanf("%s%s %c %d %s %s",p1->id,p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
     p2->next=p1;
     p2=p1;
     while(1)
     {
          p1=(struct student *)malloc(LEN);
          scanf("%s",p1->id);
          if(strcmp(p1->id,"end")==0)
          {
               p2->next=NULL;
               break;            
          } 
          scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
          p2->next=p1;
          p2=p1;              
     } 
     return(head);
}
 
int main()
{
     struct student *p,*p1,*p2,*p3;
     int i,j,n=1;
     p=set();
     p1=p;p1=p1->next;p1=p1->next;
     p2=p;p2=p2->next;
     p3=p;
     while(p1!=NULL)
     {
          p2->next=p3;
          p3=p2;p2=p1;p1=p1->next;              
     }
     p2->next=p3;        //????????????????p2???? 
     p->next=NULL;       //???????p?????? 
     
     p1=p2;           //?p1??????????????????? 
     while(p1!=NULL)
     {
          printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->grade,p1->add);
          p1=p1->next;
     }
     
     return 0;
}
struct a
{
struct a *back;
char a[20];
char b[20];
char c;
char d[20];
char e[20];
char f[20];
struct a *next;      
};
int main()
{
    struct a *pHeader,*pEnd,*p1;
	struct a *p;
    pHeader=(struct a*)malloc(sizeof(struct a));
    pHeader->back=NULL;
    p1=pHeader;
    for(;;)
    {
		p=(struct a*)malloc(sizeof(struct a));
		scanf("%s",p->a);
		if(p->a[0]=='e')
		{
			pEnd=p;
			p->back=p1;
			p1->next=p;
			p->next=NULL; 
			break;
		}
		p->back=p1;
		p1->next=p;
	    p1=p;
	    scanf("%s %c %s %s %s",p->b,&p->c,p->d,p->e,p->f);
	}
    printf("%s %s %c %s %s %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
	free(p1->next);
    for(;;)
    {
		printf("%s %s %c %s %s %s\n",p1->back->a,p1->back->b,p1->back->c,p1->back->d,p1->back->e,p1->back->f); 
		p1=p1->back;
		free(p1->next);
		if(p1->back==NULL) break;
    }
}
int main()
{
	struct stu{
		char a[20];
		char b[30];
		char c;
		int d;
		char e[6];
		char f[20];
		struct stu *be;
	};
	int n=0;
	struct stu *head=NULL,*p1,*p2;
	p2=p1=(struct stu *) malloc(LEN);
	scanf("%s",p1->a);
	while ( strcmp(p1->a,"end") )
	{
		if(n) p1->be=p2;
		else  p1->be=NULL;
		n++;
		scanf("%s %c %d %s %s",(*p1).b,&(*p1).c,&(*p1).d,(*p1).e,(*p1).f);
		p2=p1;
		p1=(struct stu *) malloc(LEN);
		scanf("%s",p1->a);
	}
	while (p2!=NULL)
	{
		printf("%s %s %c %d %s %s\n",(*p2).a,(*p2).b,(*p2).c,(*p2).d,(*p2).e,(*p2).f);
		p2=p2->be;
	}
	return 0;
}
struct student
{
	char xuehao[200];
	struct student *next;
};
struct student *create(n)
{
	struct student *p1,*p2,*head;
	p1=p2=(struct student*)malloc(sizeof(struct student));
	p1->next=0;
	gets(p1->xuehao);
	while(p1->xuehao[0]!='e')
	{
		p2=p1;
		p1=(struct student*)malloc(sizeof(struct student));
		p1->next=p2;
		gets(p1->xuehao);
	}
	head=p2;
	return(head);
}
int main()
{
	struct student *p1;
	int n;
	p1=create(n);
	while(p1!=0)
	{
		printf("%s\n",p1->xuehao);
		p1=p1->next;
	}
}
struct student
{
	char information[200];
	struct student *next;
};
struct student *creat(void)
{
	int n=0;
	struct student *head;
	struct student *p1,*p2;
	p1=(struct student *)malloc(LEN);
	gets(p1->information);
	p1->next=NULL;
	p2=p1;
		do
		{
			p1=(struct student *)malloc(LEN);
			gets(p1->information);
			if(strcmp(p1->information,"end")==0)
			{
				free(p1);
				head=p2;
				break;
			}
			else
			{
				p1->next=p2;
				head=p1;
				p2=p1;
			}
		}
		while(1);
	
	
	return(head);
}

void print(struct student *head)
{
	struct student *p;
	p=head;
	if(head!=NULL)
	{
		do
		{
			puts(p->information);
			p=p->next;
		}
		while(p!=NULL);
	}
}
void main()
{
	struct student *head;
	head=creat();
	print(head);
}
struct Stu
{
	char num[20];
	char name[50];
	char sex;
	int age;
    char mark[50];
	char add[50];
	struct Stu *link;
};
void main()
{
	struct Stu *p1,*p2;
	p1=(struct Stu *)malloc(LEN);
	p2=p1;
	scanf("%s",p1->num);
	p1->link=NULL;
	while(strcmp(p1->num,"end")!=0)
	{
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->mark,p1->add);
		p1=(struct Stu *)malloc(LEN);
		p1->link=p2;
		scanf("%s",p1->num);
		p2=p1;
	}
	struct Stu *p;
	p=p1->link;
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
		p1=p->link;
		free(p);
		p=p1;
	}
}
struct student
{
	char s[100];
	struct student *next;
};
int n;
struct student *creat( )
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(len);
	gets(p1->s);
	head=0;
	while(strcmp(p1->s,"end")!=0)
	{
		n++;
		if(n==1)head=p1;
		else p1->next=p2;
		p2=p1;
		p1=(struct student*)malloc(len);
		gets(p1->s);
	}
	head->next=0;
	return(p2);
}
void print(struct student *head)
{
	struct student *p;
	p=head;
	if(head!=0)
		do
		{
			printf("%s\n",p->s);
			p=p->next;
		}while(p!=0);
}
int main()
{
	struct student *p;
	p=creat();
	print(p);
}
int n=0;
struct student
{
    char s[200];
    struct student *next;
};
struct student *creat()
{
    char k[200];
    struct student *p,*head;
    head=p=(struct student *)malloc(LEN);
    while(1)
    {
        gets(k);
        if(!(strcmp(k,"end")))
        break;
        else
        {
            if(n==0)
            {head->next=NULL;n=1;}
            else
            p->next=head;
            head=p;
            strcpy(p->s,k);
            p=(struct student *)malloc(LEN);
        }
    }
    free(p);
    return (head);
}
void print(struct student *p)
{
    if(p!=NULL)
    {
        puts(p->s);
        print(p->next);
    }
}
int main()
{
    struct student *head;
    head=creat();
    print(head);
    return 0;
}