Result: Accepted
Time: 1ms
Memory: 1092kB
#include <stdio.h>
#include <string.h>
void main()
{
char hui[210], wen[210], chuan[210];
int len;
int i, j=0, k=0;
while(scanf("%s",hui)!=EOF) {
len=strlen(hui);
wen[0]=hui[len-1];
chuan[len]=hui[0];
for(i=0;i<len;i++) {
wen[i+1]=hui[i];
chuan[i]=hui[i];
}
for(i=0;i<(len+1)/2;i++) {
if(wen[i]==wen[len-i]&&i==(len+1)/2-1)
j=1;
else if(wen[i]!=wen[len-i]){
j=0;
break;
}
}
for(i=0;i<(len+1)/2;i++) {
if(chuan[i]==chuan[len-i]&&i==(len+1)/2-1)
k=1;
else if(chuan[i]!=chuan[len-i]){
k=0;
break;
}
}
if(k==1||j==1)
printf("zz happy!\n");
else
printf("zz cry\n");
}
}