Question: Please help me code this program using C Programming Language (Not C++/C#): Notes: - Only use and - Create a file name testdata.in(to Store Sample

Please help me code this program using C Programming Language (Not C++/C#): Notes: - Only use and - Create a file name testdata.in(to Store Sample Input) and extract the data from that file

Jojo is reviewing his assignment. His assigment is an essay consisting of several pages, numbered by integers starting from 1. Just before he uploaded his assigment, he remembered that his teacher previously said that each page needs to have at least X words. To his teacher, a word is a group of consecutive characters with at least one letter that is not separated by any spaces or newlines. Unfortunately, Jojos text editor is not capable of counting the number of words on each page. He asks you to make a program that can tell him which pages only have number of words less than X. He also asked you to tell the number of words of those pages. Help him!

Format Input

The input can be read from the file testdata.in.

The first line consists of an integer

X, which represents the minimum number of words for each page the teacher wants.

The remaining lines until the end of the file describe Jojos essay. Every page of his essay is ended with a line consisting of a single character #.

Format Output

Output several lines with format page A: B word(s) without quotes, where A is the page number and B is the number of words on A-th page, and the inequality B < X holds. Output those pages sorted by the page number in ascending order. If there is no page which has words less than X, output The essay is correct without quotes.

Constraints

1 X 50000

The number of pages will not exceed 10 pages

Each line consists of a non-empty string, which length will not exceed 50 characters

Each line consists of only lower case latin alphabet and whitespaces, except the last

line of each page which consists of a single character #

The total number of lines in Jojos essay will not exceed 1000 lines, including the

lines which consist of only a single character #

Sample Input 1 (testdata.in)

10 lorem ipsum dolor sit amet consectetur adipiscing elit # sed do eiusmod tempor incididunt ut labore et dolore magna aliqua #

Sample Output (standard output)

page 1: 8 word(s)

Sample Input 2 (testdata.in) 1

jojo # lili # bibi #

Sample Output 2 (standard output)

The essay is correct

Explanation

In the first sample, the second page consists of 11 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!