Postcard boxes are small, so first check how long the longest word is. Write longest_word(s) to return the number of letters in the longest word of s. Words are separated by spaces (maybe more than one); an empty string gives 0.
longest_word("see you at the beach")→5longest_word("")→0int longest_word(const char *s)int longest_word(const char *s) {
int now = 0;
int best = 0;
for (int i = 0; s[i] != '\0'; i++) {
// your code here: a space sets now to 0; otherwise add 1 to now and keep it in best if bigger
}
return best;
}
Run tries the examples. When they look right, Submit.