#include #include #define MAXLEN 60 int main (void) { char word[MAXLEN], longword[MAXLEN], pattern[10]; int wordlen; int longest = 0; int ch; int result = 0; sprintf (pattern,"%%%ds",MAXLEN); while ((result = scanf (pattern,word)) != EOF) { if (strlen(word) > longest) { longest = strlen(word); strcpy (longword, word); } } /* Reached end of file. Print the answer. */ printf ("The longest word was \"%s\", which was %d characters long.\n", longword, longest); return 0; }