Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- #include <string.h>
- int main()
- {
- char str[256];
- printf("Input the string\n");
- fgets(str, 256, stdin);
- size_t ln = strlen(str) - 1;
- if (str[ln] == '\n')
- str[ln] = '\0';
- char *pch = strtok(str, " ,.;?!");
- int max_length = 0;
- char *max_str;
- while (pch != NULL)
- {
- if (strlen(pch) > max_length)
- max_str = pch;
- pch = strtok(NULL, " ,.;?!");
- }
- printf("The widest word: %s\n", max_str);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement