Question
Write a program that reads in a line of text, and display the acronyms in the sentences. The input are assumed be line of English
Write a program that reads in a line of text, and display the acronyms in the sentences. The input are assumed be line of English words separated by white spaces, comma, period, or exclamation point. The output contains the list of acronyms in the input. The list of acronyms you will search for: TBH, BRB, LOL, IDK, TTYL, IRL, TIA, AFK, CYA, FYI, OMG For example: Input: TBH, IDK if my hashtag will end up trending or if anyone will even like it. It will only be viral if people can relate to it IRL. Output: TBH IDK IRL 1) Name your program words.c. 2) Assume input is no longer than 1000 characters. Assume the input contains no more than 500 words. Assume each word is no more than 50 characters. 3) You may find string library functions such as strtok, strcmp, and strcpy helpful. 4) To read a line of text, use the read_line function in the lecture notes.
Here is the read_line function
int read_line(char str[], int n)
{
int ch, i = 0;
while ((ch = getchar()) != ' ')
if (i < n)
str[i++] = ch;
str[i] = '\0'; /* terminates string */
return i; /* number of characters stored */
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started