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

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