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

#include <stdio.h>
#include <string.h>
void main()
{
	char hui[210], wen[210], chuan[210];
	int len;
	int i, j=0, k=0;
	while(scanf("%s",hui)!=EOF) {
		len=strlen(hui);
		wen[0]=hui[len-1];
		chuan[len]=hui[0];
		for(i=0;i<len;i++) {
			wen[i+1]=hui[i];
			chuan[i]=hui[i];
		}

		for(i=0;i<(len+1)/2;i++) {
			if(wen[i]==wen[len-i]&&i==(len+1)/2-1)
				j=1;
			else if(wen[i]!=wen[len-i]){
				j=0;
				break;
			}
		}
		for(i=0;i<(len+1)/2;i++) {
			if(chuan[i]==chuan[len-i]&&i==(len+1)/2-1)
				k=1;
			else if(chuan[i]!=chuan[len-i]){
				k=0;
				break;
			}
		}

		if(k==1||j==1)
			printf("zz happy!\n");
		else
			printf("zz cry\n");
	}

}