Start: Dec, 27, 2015 17:15:00
2015年秋学期《程序设计基础》第三次上机考试
End: Dec, 27, 2015 20:45:00
Time elapsed:
Time remaining:

Problem_ID: E
Result: Accepted
Time: 1ms
Memory: 1092kB
Author: sasuke
In contest: 1043

#include<stdio.h>
#include<string.h>
void main()
{
	char ch[200],k;
	int n,m,p,q;
	while(scanf("%s",&ch)!=EOF)
	{
		q=p=0;
		n=strlen(ch);
		if(n==1||n==2)
			printf("zz happy!\n");
		else if(n==3)
		{
			if(ch[0]==ch[2])
				printf("zz happy!\n");
			else
				printf("zz cry\n");
		}
		else if(n>3){
		for(m=0;m<n/2-1;m++)
		{
			if(ch[m]!=ch[n-m-2])
			{
				p=1;
				break;
			}
		}
		for(m=n-1;m>n/2;m--)
		{
			if(ch[m]!=ch[n-m])
			{
				q=1;
				break;
			}
		}
		if(p==1&&q==1)
			printf("zz cry\n");
		else
			printf("zz happy!\n");
	}
	}
}