Question: Write a C program to implement the following requirement: Input: The program will read from the standard input any text up to 1 0 ,

Write a C program to implement the following requirement:
Input: The program will read from the standard input any text up to
10,000 characters.
Output: The program will sort the words in alphabetical order and
print to the standard output:
- On the first line, the sorted words separated by a comma ,.
- On the second line, the index of the sorted words separated by a
comma ,. The index start from 0.
If two words are the same, the smaller index will appear first. A word
is a string without whitespaces (space/tab/new line character).
If the input text is empty or there is no word in the input text, the
program prints nothing to stdout.
SAMPLE INPUT 1
hello World! 123
SAMPLE OUTPUT 1
123,hello,World!
2,0,1
SAMPLE INPUT 2
SAMPLE OUTPUT 2
SAMPLE INPUT 3
This is the 1ST line. This is the 2ND line.
SAMPLE OUTPUT 3
1ST,2ND,is,is,line.,line.,the,the,This,This
3,8,1,6,4,9,2,7,0,5

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!