-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1237.c
More file actions
29 lines (29 loc) · 775 Bytes
/
Copy path1237.c
File metadata and controls
29 lines (29 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include<stdio.h>
#include<string.h>
int main(){
char s1[100],s2[100];
while(gets(s1) && gets(s2)){
int max=0,count=0;
for(int i=0;i<strlen(s1);i++){
for(int j=0;j<strlen(s2);j++){
if(s1[i]==s2[j]){
int a=i,b=j;
while(a<strlen(s1) && b<strlen(s2)){
if(s1[a++]==s2[b++]){
count++;
}
else{
break;
}
}
if(max<count){
max=count;
}
count=0;
}
}
}
printf("%d\n",max);
}
return 0;
}