Question
O Consider a single string object that consists a very long text containing a very large number of words in it, all in lower
![image text in transcribed](https://dsd5zvtm8ll6.cloudfront.net/questions/2024/05/663c532e97f47_1715229493735.jpg)
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".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-text-image.webp)
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Step: 3
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started