In the given file named
input, find the frequency of all the words and print as per the following format.
The first column of each line of the output should be the frequency of the word followed by all the words of that frequency arranged in lexicographical order separated with space “
Sort the words in the ascending order of frequency.
For simplicity, assume that
theare treated as different words.
input has following content:
the day is sunny it is the sunny day we can go out
Your script should output the following, sorted by the ascending frequency:
1 can go it out we 2 day is sunny the
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.