Question: Write a C program to run on ocelot to find the total count of words and optionally the longest and or shortest words in a

Write a C program to run on ocelot to find the total count of words and optionally the longest and or shortest words in a string input by the user or coming from a file. If there is no filename the user would be prompted to enter the string. You must use getopt to parse the command line. The string would not be input on the command line.

Usage: countwords [-l] [-s] [filename]

The l flag means to find the longest word in the string. The s option means to find the shortest word in the string. You may have both or one of the flags. Output should be well formatted and easy to read. Code should be nicely indented and commented. Create a simple Makefile to compile your program into an executable called count words.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!