条件看好子序列1-999,说明两个序列长度2-1998,再加上&字符,所以是3-1999
#include<iostream>
#include<cstring>
using namespace std;
int sb(char str[]){
int n=strlen(str);
if(n>=2000||n<3||n%2==0||(n%2!=0&&str[n/2]!='&'))
return 0;
for(int i=0,j=n-1;i<n/2;i++,j--){
if(!(str[i]>='a'&&str[i]<='z'&&str[j]>='a'&&str[j]<='z'&&str[i]==str[j])){
return 0;
}
}
return 1;
}
int main(){
char s[2005];
while(cin.getline(s,2005)){
if(sb(s))
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}
}