``
#include<iostream>
#include<string>
#include<memory.h>
using namespace std;
int main(int argc,char *argv[])
{
string a, b;
while (cin >> a)
{
int number[10]; //将字符串转化为数字数组
memset(number, 0, sizeof(number)); //初始化
cin >> b;
switch (b.size())
{
case 1:
{
int i = 0;
for ( i = 0; i < a.size(); i++)
{
if (a[i]>b[0])
{
cout << "YES" << endl;
break;
}
}
if (i == a.size())
cout << "NO" << endl;
break;
}
case 2:
{
int i = 0;
for ( i = 0; i +1< a.size(); i++)
{
if (a[i]>b[0] && a[i] == a[i + 1])
{
cout << "YES" << endl;
break;
}
}
if (i + 1 == a.size())
cout << "NO" << endl;
break;
}
case 3:
{
int i = 0;
for (i = 0; i + 2< a.size(); i++)
{
if (a[i]>b[0] && a[i] == a[i + 1]&&a[i]==a[i+2])
{
cout << "YES" << endl;
break;
}
}
if (i + 2 == a.size())
cout << "NO" << endl;
break;
}
case 4:
{
int i = 0;
for (i = 0; i + 3< a.size(); i++)
{
if (a[i]>b[0] && a[i] == a[i + 1] && a[i] == a[i + 2]&&a[i]==a[i+3])
{
cout << "YES" << endl;
break;
}
}
if (i + 3 == a.size())
cout << "NO" << endl;
break;
}
case 5:
{
//统计字符
for (int i = 0; i < a.size(); i++)
{
number[a[i]-'0']++;
}
int i = 0;
for (i = 1; i <=5; i++)
{
if ((i>b[0] - '0') && (number[i]>0)&&(number[i + 1] > 0) && (number[i + 2] > 0) && (number[i + 3] > 0) && (number[i + 4] > 0))
{
cout << "YES" << endl;
break;
}
}
if (i > 5)
cout << "NO" << endl;
break;
}
default:
break;
}
}
return 0;
}