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

#include<stdio.h>
#include<string.h>

int main()
{
	char a[202],b[202];
	int i,len;
	int temp1=1,temp2=1;

	while(scanf("%s",a) != EOF)
	{
		strcpy(b,a);
		len=strlen(a);
		a[len]=a[0];
		for(i=0;i<(len+1)/2;i++)
		{
			if(a[i] != a[len-i])
			{
				temp1=0;
				break;
			}
		}
		
		for(i=len-1;i>=0;i--)
		{
			b[i+1]=b[i];
		}
		b[0]=b[len];
		for(i=0;i<(len+1)/2;i++)
		{
			if(b[i] != b[len-i])
			{
				temp2=0;
				break;
			}
		}
		if(temp1 || temp2)
			printf("zz happy!\n");
		else
			printf("zz cry\n");

		temp1=1;
		temp2=1;
	}

}