uwu part 1: Define a string containing the characters uwu as an adorable string. When testing...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
uwu part 1: Define a string containing the characters "uwu" as an adorable string. When testing a string for adorability, it does not matter whether or not the characters u, w, and u appear side-by-side, so long as they appear in that order. "uwu" is an adorable string, as is "uwuwu", but "wuu" and "uuw" are not adorable strings. Also, though, "uxwxu" is considered an adorable string, since although the characters u, w, and u are separated by the character 'x', they still appear in the string in the proper order. Strings count as adorable regardless of the case of the characters: "UwU" is adorable, as are "uWu" and "UWu". Write a program that reads a file containing a string on each line, and prints: ● How many strings are in the file How many of these strings are adorable The adorability value of the file as a whole, expressed as a floating-point number between 0 and 1. For example, if 7 out of 10 strings in the file are adorable, the adorability value of the file is 0.7 ● ● Follow the output format below exactly: There are [total count of strings in the file] lines in the file [filename] [count of adorable strings] of these lines are adorable. The adorability value of [filename] is [adorability value] uwu Part 2: Define the adorability count of a string as the number of occurrences of u, w, and u in that order in the string. The string "uwu" has an adorability count of 1, the string "OwO" has an adorability count of 0, and the string "did you watch naruto?" has an adorability count of 1, because the letters u, w, and u appear in that order. However, the string "do you want to run like naruto?" has an adorability count of 2: the first occurrence of uwu consists of the u in "you", the w in "want", and the u in "run", while the second occurrence of uwu consists of the u in "you", the w in "want", and the u in "naruto". The string "uwu uwu" has an adorability count of 6. I've indicated each adorable substring with underlines: uwu uwu uwu uwu uwu uwu uwu uwu uwu uwu uwu uwu Write a function that takes a single string as input, then returns its adorability count. NOTE: this part is far and away the most difficult part of the problem. Write out your strategy on paper and step through it (pretend you're the computer) before you try to implement it in code. Verify to the best of your abilities that your solution is indeed correct. If you try to write this in C++ without thoroughly verifying your algorithm on paper first, you will almost certainly not be able to find a valid solution. There are both recursive and iterative solutions to this question. I used a recursive solution, but you don't have to. NOTE: the methods you develop to detect adorability can be used for much more serious purposes. I first encountered this problem in the context of finding particular strings of DNA in a genome. uwu Part 3: Using your function from part 2, write a program that asks the user for a filename, opens that filename, and prints the following information about the file: ● How many strings are in the file How many of these strings are adorable The adorability proportion of the file. The most adorable string in the file. Adorability proportion consists of the total adorability count of all lines in the file, divided by the number of lines. Represent the adorability proportion as a floating-point number. Because lines can have an adorability count of more than 1, it is possible for the adorability proportion to be greater than 1. For example, a file containing the following lines: uwu wha???? uwuuu has an adorability proportion of 1.33. There are three lines, the first line has an adorability count of 1, the second line has an adorability count of 0, and the third line has an adorability count of 3. Therefore, the total adorability count of the file is 4, the total number of lines in the file is 3, and so the adorability proportion is 4/3, or 1.333. Match the output format below exactly: There are [total count of strings in the file] lines in the file [filename] [count of adorable strings] of these lines are adorable. The adorability proportion of [filename] is [adorability proportion] The most adorable line is [text of the line with the highest adorability count] Extra credit for developing extremely efficient methods of determining string adorability (though full credit given for any working method, no matter how inefficient). uwu part 1: Define a string containing the characters "uwu" as an adorable string. When testing a string for adorability, it does not matter whether or not the characters u, w, and u appear side-by-side, so long as they appear in that order. "uwu" is an adorable string, as is "uwuwu", but "wuu" and "uuw" are not adorable strings. Also, though, "uxwxu" is considered an adorable string, since although the characters u, w, and u are separated by the character 'x', they still appear in the string in the proper order. Strings count as adorable regardless of the case of the characters: "UwU" is adorable, as are "uWu" and "UWu". Write a program that reads a file containing a string on each line, and prints: ● How many strings are in the file How many of these strings are adorable The adorability value of the file as a whole, expressed as a floating-point number between 0 and 1. For example, if 7 out of 10 strings in the file are adorable, the adorability value of the file is 0.7 ● ● Follow the output format below exactly: There are [total count of strings in the file] lines in the file [filename] [count of adorable strings] of these lines are adorable. The adorability value of [filename] is [adorability value] uwu Part 2: Define the adorability count of a string as the number of occurrences of u, w, and u in that order in the string. The string "uwu" has an adorability count of 1, the string "OwO" has an adorability count of 0, and the string "did you watch naruto?" has an adorability count of 1, because the letters u, w, and u appear in that order. However, the string "do you want to run like naruto?" has an adorability count of 2: the first occurrence of uwu consists of the u in "you", the w in "want", and the u in "run", while the second occurrence of uwu consists of the u in "you", the w in "want", and the u in "naruto". The string "uwu uwu" has an adorability count of 6. I've indicated each adorable substring with underlines: uwu uwu uwu uwu uwu uwu uwu uwu uwu uwu uwu uwu Write a function that takes a single string as input, then returns its adorability count. NOTE: this part is far and away the most difficult part of the problem. Write out your strategy on paper and step through it (pretend you're the computer) before you try to implement it in code. Verify to the best of your abilities that your solution is indeed correct. If you try to write this in C++ without thoroughly verifying your algorithm on paper first, you will almost certainly not be able to find a valid solution. There are both recursive and iterative solutions to this question. I used a recursive solution, but you don't have to. NOTE: the methods you develop to detect adorability can be used for much more serious purposes. I first encountered this problem in the context of finding particular strings of DNA in a genome. uwu Part 3: Using your function from part 2, write a program that asks the user for a filename, opens that filename, and prints the following information about the file: ● How many strings are in the file How many of these strings are adorable The adorability proportion of the file. The most adorable string in the file. Adorability proportion consists of the total adorability count of all lines in the file, divided by the number of lines. Represent the adorability proportion as a floating-point number. Because lines can have an adorability count of more than 1, it is possible for the adorability proportion to be greater than 1. For example, a file containing the following lines: uwu wha???? uwuuu has an adorability proportion of 1.33. There are three lines, the first line has an adorability count of 1, the second line has an adorability count of 0, and the third line has an adorability count of 3. Therefore, the total adorability count of the file is 4, the total number of lines in the file is 3, and so the adorability proportion is 4/3, or 1.333. Match the output format below exactly: There are [total count of strings in the file] lines in the file [filename] [count of adorable strings] of these lines are adorable. The adorability proportion of [filename] is [adorability proportion] The most adorable line is [text of the line with the highest adorability count] Extra credit for developing extremely efficient methods of determining string adorability (though full credit given for any working method, no matter how inefficient).
Expert Answer:
Answer rating: 100% (QA)
I have attached the functions along with a driver program to test the program The code is fairly sim... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these electrical engineering questions
-
In C program language 1. Triplet Prodigies: Write a C program called lastname Triplets that accepts any number of integers. The program (parent process =P) should create 3 children, C1, C2, and C3,...
-
A language L is complete for a language class C with respect to polynomial-time reductions if L C and L P L for all L C. Show that ; and {0, 1} * are the only languages in P that are not complete...
-
Design and develop programs using assembly language and C language to gain insight into instructions of microprocessors and microcontrollers. Write down a assembly language implementation to move a...
-
Write a short email to your instructor, discussing what you believe are your greatest strengths and weaknesses from an employment perspective. Next, explain how these strengths and weaknesses would...
-
Using the data for Lyon Research Corporation in Exercise 12-17, assume that as of December 31, 2006, the M-Labs, Inc., stock had a market value of $28 per share and the Spectrum Corp. stock had a...
-
1. Would an investment in Microsoft stock satisfy the definition of investment contract? 2. Why do you think Congress added the term investment contract to the definition of security? The Howey...
-
On the Internet, find sites describing examples of the bill-and-hold technique.
-
Elizabeth Johnson, CPA, has completed the audit of notes payable and other liabilities for Valley River Electrical Services and now plans to audit contingent liabilities and commitments. Required a....
-
using the ticker(subject to used input) enter formulae in thecalls below (in yellow) that will return the desiredinformation Consider the data to the left. Please answer the following questions....
-
Derive Laplace transforms of the input signals shown in Figs. E3.2 and E3.3 by summing component functions found in Table 3.1. 10 f(t) 3 t (min) Figure E3.2 Slope = -a u(t) tw Figure E3.3 Triangular...
-
Q10. In the system given below, consider the initial states as: AB: HVB, CD: HcVc + 1 VcH, EF: HH, GI: 1 2 VGH + HGV1. The joint measurement outcomes are demonstrated on the setup below. What is the...
-
A composite material is to be made of alternating sheets of polyethylene (core matrix) and aluminum (reinforcement). The individual materials (polyethylene and aluminum) have elastic moduli of 1 and...
-
Solve the following linear programming problem, using the Simplex Method. objective subject to maximize P 105x + 28y 3x - 12y 9 2x + 6y 18 x 0, y 0 The maximum value of P is and occurs at (x, y) =
-
1. How can technology be used to liberate senior citizens and others with driving impairment? 2. How can technology be used to liberate the customer service reps?
-
find similar cases or jurisprudence to this issue? please based to the photo below 28 February 2023 BUREAU OF INTERNAL REVENUE - REVENUE REGION NO. 3 Pagayaya Street, Regional Government Center,...
-
Solve 4t 81 - +2 dt
-
Provide a brief description of a client (child or adult) that you think would benefit from play therapy. Following Herman's Three Stages of Recovery, describe a play therapy technique that you...
-
Write a paper by answer the following question: Should Recycling Be Mandatory?
-
Moral Hazard versus Adverse Selection in Health Care Reform: We mentioned moral hazard only brieflyand primarily in the context of how this might aggravate the adverse selection problem. In this...
-
Suppose there are three possible candidates that might run for office, and each has to decide whether or not to enter the race. Assume the electorates ideal points can be defined by the Hotel ling...
-
Sometimes we can infer something about tastes from observing only two choices under two different economic circumstances. A. Suppose we consume only beer and pizza (sold at prices p1 and p2...
-
Repeat 6.19 using \(x(0)=-2\).
-
Using the compact storage technique described in Section 6.8, determine the vectors DIAG, OFFDIAG, COL, and ROW for the following matrix: \[\mathbf{S}=\left[\begin{array}{cccccc}17 & -9.1 & 0 & 0 &...
-
Expand $6 \sqrt{\Pi_{k=1}^{3} \Pi_{m=1^{\prime}}^{2^{\prime}} D_{k m}}$
Study smarter with the SolutionInn App