#include #include #include #include #include #include #include #include #define LL long long #define pb push_back #define lm 10001 #define MOD 1000000007 using namespace std; char s[16]={'+','-','[',']','B','D','I','P','S','X','b','d','i','p','s','x'}; string l; int main() { //freopen("data.in","r",stdin); while(getline(cin,l)) { bool k,o,var=0,ok=true; if(ok) { if(l.find("BP")!=string::npos || l.find("bP")!=string::npos || l.find("bp")!=string::npos || l.find("Bp")!=string::npos) { if(l.find("BX")!=string::npos || l.find("bX")!=string::npos || l.find("bx")!=string::npos || l.find("Bx")!=string::npos) { cout<<"ERROR\n"; ok=false; } } } if(ok) if(l.find("SI")!=string::npos || l.find("sI")!=string::npos || l.find("si")!=string::npos || l.find("Si")!=string::npos) { if(l.find("DI")!=string::npos || l.find("dI")!=string::npos || l.find("di")!=string::npos || l.find("Di")!=string::npos) { cout<<"ERROR\n"; ok=false; } } if (ok) for(int i=0; i='0' && l[i]<='9') { k=1; o=true; } } if(!o) { if(l[i]>='a' && l[i]<='z') { if(!var) { var=1; k=1; } else k=0; o=true; } } if(!k) { cout<<"ERROR\n"; ok=false; break; } } l+=" "; l=" "+l; if(ok) for(int i=0; i