// editor3
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;
bool isValidAlphanumeric(const string& s){
    if(s.empty()) return false;
    
    for(char c : s){
        if(!isalnum(c) && !isspace(c) && c != ', && c != '.' && c != '!' && c != '?'){
            
        }
    }
    if (s.find('-') != string::npos || (s.find('.') != string::npos && s.find_first_not_of("0123456789.") == string::npos )){
        return false;
    }
    return true;
}
int main (){
    string input;
    if(!getline(cin,input)) return 0;
    
    if(!isValidAlphanumeric(input)){
       cout<<"INVALID INPUT"<<endl;
       return 0;
    }
    string filtered ="";
    for(char c:input){
        if(isalnum(c)) {
            filtered += tolower(c);
        }
    }
    string reversed=filtered;
    reverse(reversed.begin(),reversed.end());
    
    if(!filtered.empty() && filtered == reversed) {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    
    return 0;
}