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: 1104kB
Author: 2015210402089
In contest: 1043

#include<stdio.h>
#include<string.h>
int f(char a[200])
{
	int i,j,n;
	i=0;
	n=strlen(a)-1;
		while(a[i]==a[n])
		{
			n--;
			i++;
		}
		if(i<n)
			return -1;
		else
			return 1;
}
int main(void)
{
	char a[200],b[200],c[200];
	int length,t;
	while((scanf("%s",a))!=EOF)
	{
	length=strlen(a);
	b[0]=a[length-1];
	b[1]='\0';
	c[0]=a[0];
	c[1]='\0';
	strcat(b,a);
	strcat(a,c);
	if(f(b)>0||f(a)>0)
	{	
		printf("zz happy!\n");
	}
	else
	{
		printf("zz cry\n");
	}
	}
	return 0;
}