#include<string>
using namespace std
struct puke
{
string str
puke *next
}
struct puke* creat(void)
{
int i
struct puke *head,*p,*q
p=new puke
head=p
q=p
cin>>p->str
for(i=0i<25i++)
{
q=p
p=new puke
cin>>p->str
q->next=p
}
q=q->next
q->next=NULL
return head
}
struct puke* last(struct puke*head)
{
while(head->next!=NULL)
{
head=head->next
}
return head
}
/*void display(struct puke *head)
{
while(head!=NULL)
{
cout<<head->str
head=head->next
}
} */
int main()
{
puke *head1,*last1,*head2,*last2
puke *p1,*p2,*q1,*q2
int i,j=0,k=0,n=0,m
bool flag
head1=creat()
head2=creat()
p1=head1
p2=head2
last1=last(head1)
last2=last(head2)
// display(head1)
string str[52]
for(i=0i++)
{
if(i%2==0)
{
str[n]=p1->str
p1=p1->next
flag=0
}
else
{
str[n]=p2->str
p2=p2->next
flag=1
}
m=n
cout<<str[n]<<endl
n++
for(j=0j<mj++)
{
if(str[m]==str[j])
{
k=m
n=j
// cout<<m<<" "<<k<<" "<<n<<" "<<flag<<endl
if(flag==0)
{
for(jj<=kj++)
{
last1->next=q1
q1=new puke
q1->str=str[j]
last1=q1
str[j]='0'
}
last1->next=NULL
}
if(flag==1)
{
for(j<=kj++)
{
last2->next=q2
q2=new puke
q2->str=str[j]
last2=q2
str[j]='0'
}
last2->next=NULL
}
continue
}
}
if(p1==NULL||p2==NULL)
{
break
}
}
// cout<<i<<endl
if(p1==NULL)
cout<<"Bob"<<endl
else
cout<<"Alice"<<endl
return 0
}
自己电脑上测试可以。。求采纳。