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: 2015210402002
In contest: 1043

#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main()
{
	char a[204];
	while(scanf("%s",&a)!=EOF)
	{
		int i,flag=1,flag1=1;
		if(strlen(a)!=3)
		{
			for(i=1;i<strlen(a)/2;++i)
			{
				if(a[i]!=a[strlen(a)-i])
				{
					flag=0;
					break;
				}
			}
			for(i=0;i<strlen(a)/2;++i)
			{
				if(a[i]!=a[strlen(a)-2-i])
				{
					flag1=0;
					break;
				}
			}
			if(flag||flag1)
				printf("zz happy!\n");
			else
				printf("zz cry\n");
		}
		else
		{
			if(a[0]==a[1]||a[1]==a[2]||(a[1]==a[2]&&a[0]==a[1]))
				printf("zz happy!\n");
			else
				printf("zz cry\n");
		}
	}
}