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

#include<stdio.h>
#include<string.h>
 int main()
 {
	 int i,l,m;
	 char a[200];
	 while(scanf("%s",a)!=EOF)
	 {
		 m=0;
		 l=strlen(a)-1;
		 if((l+1)==2||l+1==1)
			 m++;
		 if((l+1)==3&&a[1]==a[2])
			 m++;
		 for(i=0;i<(l/2);i++)
		 {
			 if(a[i]!=a[l-i-1])
				 break;
		 }
		 if(i==l/2&&a[i-1]==a[l-i])
			 m++;
		
		  for(i=1;i<((l+1)/2);i++)
		 {
			 if(a[i]!=a[l-i+1])
				  break;
		 } 
		  if(i==((l+1)/2)&&a[i-1]==a[l-i+2])
		  {
			 m++;
			
		  }
		 
		  if(m>0)
			  printf("zz happy!\n");
		  else
			  printf("zz cry\n");
	 }
 }