#8587: 誰能告訴我錯在哪?


sdd5426 (黑白小羊)


像abba這類偶數字數的字串沒問題

但abcba怎麼樣都會錯

請神人幫我看看

#include <iostream>
#include <string.h>
using namespace std;
int main()
{
 char a[1000],b,c;
 bool k=false;
 while(gets(a)){
  int n=strlen(a);
  for(int k=0;k<n/2+1;k++)
  b=a[k];
  for(int t=n;t>n/2-1;t--)
  c=a[t-1];
  if(b==c)
   printf("yes\n");
  else
   printf("no\n");
 }
 
return 0;
}