#include <iostream>
using namespace std;
int main()
{
string n;
cin >> n;
bool inc = true, dec = true;
for(int i = 1; i < n.size(); i++)
if(n[i] <= n[i - 1])
{
inc = false;
break;
}
for(int i = 1; i < n.size(); i++)
if(n[i] >= n[i - 1])
{
dec = false;
break;
}
if(inc || dec)
cout << "NO";
else
cout << "YES";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKQp7CiAgICBzdHJpbmcgbjsKICAgIGNpbiA+PiBuOwogICAgYm9vbCBpbmMgPSB0cnVlLCBkZWMgPSB0cnVlOwogICAgZm9yKGludCBpID0gMTsgaSA8IG4uc2l6ZSgpOyBpKyspCiAgICAgICAgaWYobltpXSA8PSBuW2kgLSAxXSkKICAgICAgICB7CiAgICAgICAgICAgIGluYyA9IGZhbHNlOwogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICBmb3IoaW50IGkgPSAxOyBpIDwgbi5zaXplKCk7IGkrKykKICAgICAgICBpZihuW2ldID49IG5baSAtIDFdKQogICAgICAgIHsKICAgICAgICAgICAgZGVjID0gZmFsc2U7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgIGlmKGluYyB8fCBkZWMpCiAgICAgICAgY291dCA8PCAiTk8iOwogICAgZWxzZQogICAgICAgIGNvdXQgPDwgIllFUyI7CiAgICByZXR1cm4gMDsKfQoK