#include <stdio.h>
void main()
{
char str[100];
int i,maxloc=0,maxlen=0,wordloc,wordlen;
printf("please input string:");
gets(str);
i=0;
while(str[i]!='\0')
{
while(str[i]==' ')
i++;
wordloc=i;
wordlen=0;
while(str[i]!='\0'&&str[i]!=' ')
{
wordlen++;
i++;
}
if(wordlen>maxlen)
{
maxloc=wordloc;
maxlen=wordlen;
}
}
printf("the max word is:");
for(i=0;i<maxlen;i++)
printf("%c",str[maxloc+i]);
printf("\n");
}