Write Program Read Text End File Print Count Word Lengths E Total Number Words Length 1 Oc Q37082639

  1. Write a program to read text to end-of-file, and print a countof word lengths, i.e. the total number of words of length 1 whichoccurred, the number of length 2, and so on. Define a word to be asequence of alphabetic characters. You should allow for wordlengths up to 25 letters.

Typical output should be likethis:

                    length 1 : 10 occurrences

                                  length 2 : 19 occurrences

                                    length 3 : 127 occurrences

                                    length 4 : 0 occurrences

                                    length 5 : 18 occurrences

                                       ….


Solution


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.