# include & ltstdio.h & gt
# include & ltstring.h & gt
bool IsHuiwen(char *str) {
int len = strlen(str);
for(int i = 0,j = len-1;我& ltj;i++,j -)
if(str[i]!= str[j])返回false
返回true
}
char* GetWord(char *str,int & amp索引)
{
char word[30];
for(;str[index]= =“”;index++);
for(int I = 0;str[index]& amp;& ampstr[index]!= ' ';index++,i++)
word[I]= str[index];
word[I]= ' \ 0 ';
返回單詞;
}
void main()
{
char句子[10000],單詞[30];
int count = 0,index = 0;
gets(句子);
while(句子[索引])
{
strcpy(word,GetWord(sentence,index));
if(is Huiwen(word))count++;
}
cout & lt& lt計數& lt& ltendl
}