- 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