#include<stdio.h> #include<string.h> int main() { char arr1[300]=""; char arr2[300]=""; char temp[300]=""; while(scanf("%s %s",arr1,arr2)!=EOF) { if(strlen(arr1)>strlen(arr2)) { strcpy(temp,arr1); strcpy(arr1,arr2); strcpy(arr2,temp); } int max=0; for(int i=0;i<strlen(arr1);i++) for(int j=0;j<strlen(arr2);j++) { int count=0; while(arr1[i+count]==arr2[j+count]) count++; if (count>max) { max=count; strcpy(temp,arr1+i); temp[max]='\0'; } } printf("%s\n",temp); } return 0; }