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

#include<stdio.h>
#include<string.h>
 main()
 {
	 char str[201];
	 while(scanf("%s",str)!=EOF){
		 int i,j,n;
		 int k=0,p=0;
		 n=strlen(str)+1;
		 if(n%2==0){
				 for(j=0;j<n/2;++j)
					 if(str[n/2+j]==str[n/2-j-1])
						 k++;	
				 for(j=0;j<n/2;++j)
					 if(str[(n/2-1)+j]==str[(n/2-1)-j-1])
						 p++;
			 if(k==n/2-1 || p==n/2-1)
				 printf("zz happy!\n");
			 else
			     printf("zz cry\n");
		 }
		 else if(n%2==1){
			 for(j=1;j<=n/2;++j)
				 if(str[n/2-j]==str[n/2+j])
					 k++;
			 for(j=1;j<n/2;++j)
				 if(str[(n/2-1)+j]==str[(n/2-1)-j])
					 p++;
			 if(k==n/2-1 || p==n/2-1)
				 printf("zz happy!\n");
			 else
			     printf("zz cry\n");
		 }
	 }
 }