一糯千金小說免費閱讀伊諾
① 1. 成語糾錯
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
typedef struct gbk{
char str[401];
struct gbk *next;
}GBK;
typedef struct Idioms{
char str[9];
struct gbk *next;
}Idioms;
void main()
{
int n,m,i,j=0,x=0,y=0,count=0,flag=-1,fm[50];
scanf("%d %d",&n,&m);
GBK *pn=(GBK *)malloc(sizeof(GBK)),*p1,*headn=pn;
Idioms *pm=(Idioms *)malloc(sizeof(Idioms)),*p2,*headm=pm;
char str[8]="0000000";
for(i=0;i<m+n;i++)
{
  if(i<n)
  {
    for(j=0;j<200&&pn->str[0]!='\n';j++)
    {
     p1=(GBK *)malloc(sizeof(GBK));
     pn->next=p1;
     pn=p1;
     scanf("%s",pn->str);
     pm->next=null;
    }
  }
  else
  {
    for(j=0;j<8&&pm->str[0]!='\n';j++)
    {
     p2=(Idioms *)malloc(sizeof(Idioms));
     pm->next=p2;
     pm=p2;
     scanf("%s",pm->str);
     pm->next=null;
    }
  }
}
scanf("%s",str);
pm=headm->next;
pn=headn->next;
while(pm)
{
  for(i=0,j=1;j<9;i++,j++)
   {
    if(str[i]==pm->str[i]&&str[j]==pm->str[j]) count++;
    else flag=i;
    if(count==3)
    {
       fm[i]=1;
       break; 
    }else fm[i]=0;
   }
  pm=pm->next;
}
while(pn)
{
    for(i=0;i<strlen(pn->str);i++)
    {
       if(str[flag]==pn->str[i]&&str[flag]==pn->str[i++]) 
       {
         x=1;break;
       }
    }
    if(x==1) break;
    pn=pn->next;
}
x=0;
for(y=0;y<50;y++)
{
 if(fm[y]==1) 
  {
     for(i=0;i<strlen(pn->str);i++) 
     {
       if(headm->str[flag]==pn->str[i]&&headm->str[flag+1]==pn->str[i+1])
           {x=1;break;}
     }
     if(x==1) break;
     pm=pm->next;
  }
 else pm=pm->next;
}
printf("%s",pm->str);
}
