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