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


#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	char name[200],name2[200],c;
	int n,m,i,total,a,N;
	while(scanf("%s",name)!=EOF)
	{
		a=0;
		total=0;
		n=strlen(name);
		strcpy(name2,name);
		m=(n+1)/2;
		N=n+1;
		for(i=0;i<n+1;++i)
		{
			c=name[0];
			if(i==0)
				name[i]=name[n-1];
			else 
				name[i]=name2[i-1];
		}
		for(i=0;i<m;++i)
		{
			if(name[i]==name[N-i-1])
				total++;
		}
		if(total==m)
		{
			a++;
		}
		total=0;
		for(i=0;i<n+1;++i)
		{
			if(i<n)
				name2[i]=name2[i];
			else if(i==n)
				name2[i]=name2[0];
		}
		for(i=0;i<m;++i)
		{
			if(name2[i]==name2[N-i-1])
				total+=1;
		}
		if(total==m)
		{
			a++;
		}
		if(a>0)//输出
			printf("zz happy!\n");
		else
			printf("zz cry\n");
	}
	
}