#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main (void)
{
int t, max;
string s1, s2, st;
while(cin >> s1 >> s2)
{
if(s1.length()==1 || s2.length()==1)
{
break;
}
s1 = s1 + s1;
s2 = s2 + s2;
max = 0;
while(s2.length() > 0)
{
for(int i=1; i<=s2.length(); i++)
{
t = s1.find(s2.substr(0, i));
if(t>-1 && i>max)
max = i;
}
s2.erase(0, 1);
}
cout << max << endl;
}
return 0;
}
//判斷一個字符串是否包含在另一個字符串之內(連續)
int main (void)
{
int t, max;
string s1, s2, st;
while(cin >> s1 >> s2)
{
if(s1.find(s2)==s1.npos) //s1是否包含s2
cout<<"NO"<<endl;
else
cout<<"YES"<<endl;
}
return 0;
}
//判斷一個字符串是否包含在另一個字符串之內(非連續)
#include <iostream>
#include <string>
#include <cstdio>
#include<regex>
using namespace std;
string a="happy";
int main ()
{
string str;
cin>>str;
regex pattern(a);
if(regex_match(str,pattern))
cout<<"No!"<<endl;
else
cout<<"Yes!"<<endl;
return 0;
}
