#include?<string.h>
#include?<ctype.h>
char?*biggest(char?str[],char?max[])?{
int?i?=?0,j;
char?word[100];
max[0]?=?'\0';
while(str[i])?{
while(str[i]?&&?!isalpha(str[i]))?++i;?//?濾除非字母字符
j?=?0;
while(isalpha(str[i]))?//?開始讀取單詞
word[j++]?=?str[i++];
word[j]?=?'\0';
if(strcmp(word,max)?>?0)?strcpy(max,word);
}
if(j?>?0)?{
word[j]?=?'\0';
if(strcmp(word,max)?>?0)?strcpy(max,word);
}
return?max;
}
int?main()?{
char?str[100],word[100];
printf("please?input?a?sentence:\n");
gets(str);
printf("最大單詞是:%s\n",biggest(str,word));
return?0;
}