O Consider a single string object that consists a very long text containing a very large...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
O Consider a single string object that consists a very long text containing a very large number of words in it, all in lower case letters, and there is no punctuation. The following is an example where we only have 16 words in the text. my_string "in the end it is not the years in your life that count it is the life in your year! Write a program that calculates and prints: the number of words to be read until the last word of the test is heard for the first time (8). the number of remaining words after the first word is read for the last time (2), the number of different words until we hear the first word for the last time (11), the number of common words used in the first and the second half of the text (if the number of words is odd, the word in the middle should be considered in the first half of the text) (6), the letter (in capital) which separates the first approximate half of the used words from the second approximate half when all words that have been used are sorted alphabetically in text format which clearly state which of the above expressions is equal to each value. Your program should be generic, i.e. it must print correct results for any string object that obeys above rules. For the above short-sized string, the output should be like: The number of words to be read until the last word of the test is heard for the first time is 8. The number of remaining words after the first word is read for the last time is 2. The number of different words until we hear the first word for the last time is 11. The number of common words used in the first and the second half of the text is 6. The letter which separates the first approximate half of the used words from the second approximate half when all words that have been used are sorted alphabetically is "L". O Consider a single string object that consists a very long text containing a very large number of words in it, all in lower case letters, and there is no punctuation. The following is an example where we only have 16 words in the text. my_string "in the end it is not the years in your life that count it is the life in your year! Write a program that calculates and prints: the number of words to be read until the last word of the test is heard for the first time (8). the number of remaining words after the first word is read for the last time (2), the number of different words until we hear the first word for the last time (11), the number of common words used in the first and the second half of the text (if the number of words is odd, the word in the middle should be considered in the first half of the text) (6), the letter (in capital) which separates the first approximate half of the used words from the second approximate half when all words that have been used are sorted alphabetically in text format which clearly state which of the above expressions is equal to each value. Your program should be generic, i.e. it must print correct results for any string object that obeys above rules. For the above short-sized string, the output should be like: The number of words to be read until the last word of the test is heard for the first time is 8. The number of remaining words after the first word is read for the last time is 2. The number of different words until we hear the first word for the last time is 11. The number of common words used in the first and the second half of the text is 6. The letter which separates the first approximate half of the used words from the second approximate half when all words that have been used are sorted alphabetically is "L".
Expert Answer:
Related Book For
Vector Mechanics for Engineers Statics and Dynamics
ISBN: 978-0073212227
8th Edition
Authors: Ferdinand Beer, E. Russell Johnston, Jr., Elliot Eisenberg, William Clausen, David Mazurek, Phillip Cornwell
Posted Date:
Students also viewed these physics questions
-
ces Outdoor Luggage, Incorporated, makes high-end hard-sided luggage for sports equipment. Data concerning three of the company's most popular models appear below. Ski Guard Golf Guard Selling price...
-
The St. Louis to Seattle Railroad is considering acquiring equipment at a cost of $255,000. The equipment has an estimated life of 10 years and no residual value. It is expected to provide yearly net...
-
The mean number of patients admitted per day to the emergency room of a small hospital is1.5 1.5. If, on any given day, there are only3 3beds available for new patients, what is the probability that...
-
What is the significance of a constructive dividend?
-
A hot-air balloon rises straight up from the ground at a rate of 120 ft / min. The balloon is tracked from a rangefinder on the ground at point P, which is 400 ft from the release point Q of the...
-
The following trial balance was extracted from the books of a sole trader, as at 31 December 2006: At the end of December the trader was able to produce the following additional information: a Stock...
-
The following transactions of Philadelphia Pharmacies occurred during 2017 and 2018: 2017 Jan. 9 Purchased computer equipment at a cost of $7,000, signing a six-month, 8% note payable for that...
-
For the following observed and expected frequencies: Observed Expected 41 45 22 40 26 31 26 44 28 28 Can you conclude that the distribution of observed frequencies differs from that given by the...
-
Presented here are selected transactions for Blossom Limited for 2024. Blossom uses straight-line depreciation and records adjusting entries annually. Jan. Sept. Dec. (a) 1 1 30 Sold a delivery truck...
-
. Corvallis Chemical Company is designing a new filling station to transfer liquid chemicals from their production process to tanker trucks. The chemicals are contained in a large holding tank and...
-
The Company is an automatet parking garage company. The Company is transitioning from only selling to developing, producing, and marketing.The company has introduced a Condition Based Maintenance...
-
Which budget is the starting point to prepare financial budget? Explain.
-
On January 1, 2017, Alison, Inc., paid $69,200 for a 40 percent interest in Holister Corporation's common stock. This investee had assets with a book value of $218,000 and liabilities of $91,000. A...
-
Differentiate the following important entrepreneurial concepts a. Entrepreneurial cognitions and Opportunity recognition (3 marks) b. Innovation threshold and Diffusion of Innovation (3 marks)
-
Various organizations have laid down principles for risk management. There are risk management principles laid down by the International Standardization Organization (ISO) and by the Project...
-
Perform the operation by first converting the numerator and denominator to scientific notation. Write the answer in scientific notation. 7,200,00/0.000009
-
Following are the unit costs of making and selling a single product at a normal level of 5,000 units per month and a current unit selling price of $90: Consider each requirement separately. Label all...
-
Mechanic's Aids Company operates 20 injection molding machines in the pro- duction of tool boxes of four different sizes, named the Apprentice, the Handyman, the Journeyman, and the Professional....
-
Lieberman Clothing Company manufactures its own designed and labeled sports attire and sells its products through catalog sales and retail outlets. While Lieberman has for years used activity-based...
Study smarter with the SolutionInn App