#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
void test()
{
string str1;
string str2;
cin>>str1>>str2;
if(str1.size()>str2.size())swap(str1,str2);
int left=0;
int right=0;
int res=0;
while(right<str1.size())
{
if(str2.find(str1.substr(left,right-left+1))!=-1)
{
res=max(res,right-left+1);
right++;
}
else
{
left++;
right++;
}
}
cout<<res;
}
int main(){
test();
return 0;
}
#include<cmath>
#include<vector>
using namespace std;
void test()
{
string str1;
string str2;
cin>>str1>>str2;
if(str1.size()>str2.size())swap(str1,str2);
int left=0;
int right=0;
int res=0;
while(right<str1.size())
{
if(str2.find(str1.substr(left,right-left+1))!=-1)
{
res=max(res,right-left+1);
right++;
}
else
{
left++;
right++;
}
}
cout<<res;
}
int main(){
test();
return 0;
}



京公网安备 11010502036488号