(example only - cannot be marked by ceilidh)
You may wish to test the program by typing
prog5rev | prog5revto see if an exact copy of the original input is recreated.
To read characters to end of data, use a loop such as either
char ch; while( ch = getchar(), ch >= 0 ) /* ch < 0 indicates end-of-data */or
char ch; while( scanf( "%c", &ch ) == 1 ) /* one character read */
Define a word to be a sequence of alphabetic characters. You should allow for word lengths up to 25 letters.
Typical output should be like this:
length 1 : 10 occurrences length 2 : 19 occurrences length 3 : 127 occurrences length 4 : 0 occurrences length 5 : 18 occurrences ....To read characters to end of data see above question.