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