Result: Accepted
Time: 1ms
Memory: 1092kB
#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");
}
}