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