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

#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");
		 }
	 }

 }