#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,b="BP"; int main() { //freopen("data.in","r",stdin); while(getline(cin,l)) { bool k,o,var=0,ok=true; 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; } } if(ok) if(l.find(b)!=string::npos) { if(l.find("BX")!=string::npos) { cout<<"ERROR\n"; ok=false; } } if(ok) if(l.find("SI")!=string::npos) { if(l.find("DI")!=string::npos) { cout<<"ERROR\n"; ok=false; } } l+=" "; l=" "+l; if(ok) for(int i=0; i