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