#include <cstdio>
struct node{
int val;
node *next;
node(){val=0;next=NULL;}
};
node *head1,*head2,*t1,*t2;
int main(){
int i;
t1 = head1;
t2 = head2;
while (true){
scanf("%d",&i);
if(i==-1){
break;
}
node *temp = new node();
temp->val = i;
temp->next = NULL;
t1->next = temp;
t1 = t1->next;
}
while(true){
scanf("%d",&i);
if(i==-1){
break;
}
node *temp = new node();
temp->val = i;
temp->next = NULL;
t2->next = temp;
t2 = t2->next;
}
t1 = head1->next;
t2 = head2->next;
while(true){
if(t1==NULL || t2==NULL){
break;
}
if(t1->val>t2->val){
t2 = t2->next;
}else if(t1->val < t2->val){
t1 = t1->next;
}else{
printf("%d ",t1->val);
t1 = t1->next;
t2 = t2->next;
}
}
printf("\n");
return 0;
}
真佩服楼主,没花一点财富值就敢提这种问题