#include
#include
#include
#include
#include
void Judge(char a[100],char b[100],char c[100]);
int main()
{
char a[100],b[100],c[100];
gets(a);
gets(b);
Judge(a,b,c);
for(int i=0;c[i]!=' ';i++)
printf("%c",c[i]);
return 0;
}
void Judge(char a[100],char b[100],char c[100])
{
int i=0,j=0,max=0,q,count=0,temp1,temp2;//temp2记录a数组中i的起始位置,temp1记录公共子串的起始位置;
while(a[i]!=' ')
{
temp2 = i;
while(b[j]!=' ')
{
if(a[i] == b[j])
{
temp1 = i;
}
while(a[i]==b[j])
{
count++;
i++;
j++;
}
if(count > max)
{
max = count;
for(q=0;q
c[q] = a[temp1];
temp1++;
}
c[q] = ' ';
}
count =0;
j++;
}
j=0;//将指针j重新指向b数组的起始位置
i = temp2+1;//i++;
}
}



