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

O Consider a single string object that consists a very long 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".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Physics Questions!