Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that prompts the user to enter two strings, a file name and a word. The program must identify the words separated by

Write a program that prompts the user to enter two strings, a file name and a word. The program must identify the words separated by arbitrary strings of whitespace characters and find the number of occurrences of the word in the file. It must be case-insensitive. For example, if the given word is the and the file has The, it should be counted. Likewise, if the given word is tHe and the file has the, it should be counted. In the provided file, alice_short.txt, the program must find the number of occurrences for it to be 7. Assume that the user gives the inputs properly, so the program does not need to check if they are valid or not

Write a program by extending the program developed for question 3 above. The main program should remain the same. However, the function in the program should be modified so that the punctuation marks at the beginning and end of each word found in the file are removed so that it begins and ends with an alphanumeric character before comparing it with the word given by the user. This way, if it is searched, it, will also be counted unlike question 3. In the provided file, alice_short.txt, the program must find the number of occurrences for it to be 11. Assume that the user gives the inputs properly, so the program does not need to check if they are valid or not

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions