Question: write a simple C function that takes in input. The input consists of one or more segments of text, where each segments consist of one
write a simple C function that takes in input. The input consists of one or more segments of text, where each segments consist of one or more words.
Words can be separated by one or more whitespaces. Whitespaces consist of regular spaces, tabs new
lines, etc. Hint: scanf will naturally ignore white space, so use scanf to read in one word at a
time. Each segment will be terminated by the word EOS The last segment in the text will only have
the terminator word. See example.
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. EOS
Pellentesque sed dolor non arcu imperdiet
placerat. EOS
dolor sit amet, consectetur adipiscing
elit. Pellentesque sed dolor non EOS
EOS
i need a while loop that keeps on reading input until there is only EOS in the line. The loop shouldn't end when encountering first EOS. It should end only when there is only EOS in the line.
In the example, the loop should end after the last EOS is entered not after the very first EOS.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
