Question: Implement a program that counts the number of single-letter words in a text file. Input and output: Your program should input the name of

Implement a program that counts the number of single-letter words in a text file. Input and output: Your 

Implement a program that counts the number of single-letter words in a text file. Input and output: Your program should input the name of a text file, and print the number of single-letter words in that file. The file name is a string, the length of which is between 1 and 60. The file contains between 1 and 1,000 lines, each of which is between 1 and 60 characters long. The characters in the file include letters, spaces, and line breaks. The file does not include digits or punctuation marks, and it also does not include blank lines. A single-letter word in that file may be a letter surrounded by spaces; a letter in the beginning of a line followed by a space; a letter in the end of a line preceded by a space; or a single-letter line. In other words, it is a letter that does not have another letter next to it. Example file: We r aliens I We talk in a strange language Wer friendly Example output: Command Prompt C:\>java Honevorkia Enter nane of the input file: nessage.txt The message includes 3 single-letter words C:\>

Step by Step Solution

3.41 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

def countsingleletterwordsfilename Counts the number of singleletter words in a text file Args filename The name of the text file Returns The number o... View full answer

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 Programming Questions!