Alice wants to track how regular she is at exercising. On a single line via Standard...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Alice wants to track how regular she is at exercising. On a single line via Standard Input, you're given her exercise record over several days. A Yindicates that she exercised on that day, and an Nindicates that she did not. For example, an input line could look like: YYNYYYNNY A streak is defined as a set of consecutive days when Alice exercised i.e. a set of consecutive s Your task is to find the length of the longest streak in the input, and print that number on a single line to Standard Output. Example Input YYNYYYNNY Output 3 Alice wants to track how regular she is at exercising. On a single line via Standard Input, you're given her exercise record over several days. A Yindicates that she exercised on that day, and an Nindicates that she did not. For example, an input line could look like: YYNYYYNNY A streak is defined as a set of consecutive days when Alice exercised i.e. a set of consecutive s Your task is to find the length of the longest streak in the input, and print that number on a single line to Standard Output. Example Input YYNYYYNNY Output 3
Expert Answer:
Answer rating: 100% (QA)
You can achieve this in Python by reading the exercise record iterating throu... View the full answer
Related Book For
Introduction To Materials Management
ISBN: 978-9386873248
8th edition
Authors: Arnold J. R. Tony, Gatewood Ann K., M. Clive Lloyd N. Chapman Stephen
Posted Date:
Students also viewed these programming questions
-
What are the implications of habitat fragmentation and landscape connectivity for species dispersal, gene flow, and ultimately, biodiversity conservation efforts?
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Two-dimensional array operations: Movie Ratings program ** You have recently collected reviews from four movie reviewers where the reviewers are numbered 1-4. Each reviewer has rated six movies where...
-
You have $300,000 saved for retirement. Your account earns 6% interest. How much will you be able to pull out each month, if you want to be able to take withdrawals for 20 years? $ Get help: Video
-
A spacecraft of mass m describes a circular orbit of radius us r 1 around the earth. (a) Show that the additional energy E which must be imparted to the spacecraft to transfer it to a circular orbit...
-
The following data pertain to Tyne Companys investments in marketable equity securities. (Assume that all securities were held throughout 20X0 and 20X1.) Required: 1. What amount should Tyne report...
-
Discuss how a collaboration diagram represents the organization of objects that must cooperate to reach an objective.
-
Toth Company had the following assets and liabilities on the dates indicated. December 31Total AssetsTotal Liabilities 2018.......................$400,000 ......................$260,000...
-
1. Construct a truth table for the following: a. out x'yz +(xyz)' b. out (x+z')(x+y')(y+z) 2. Simplify the following functional expressions using Boolean algebra and its identities. List the identity...
-
8.1 Create a one-way data table for profit at different levels of supplier contact in range B22:C33. Ensure that the price in cell C3 is $290 and the advertising budget in cell C5 is $35,000,000 (you...
-
7. Let H be a Hilbert space with an orthonormal basis {e,..., en}. (a) Show that any x H can be written in a unique form as x = c = (x, ej). => (b) Show that if x=e, and y =de, then " (x, y) = d. j-1...
-
Determine the if-else statement that suits the comments given in the program. LINE 01: #include LINE 02: using namespace std; LINE 03: LINE 04: int main() LINE 05: { LINE 06: bool button1 = true;...
-
Complete the following program based on the comments provided. #include //include the file stream header file #include using namespace std; int main() { //open a file with the name greeting.txt...
-
You have an algorithm called "k-Means-Medians-Modes". It takes into consideration the mean, median and mode simultaneously of each cluster. (a) Do you think this algorithm would perform well ?...
-
Modify the following if-else statement into switch case statement. public void TestMethod (Animal animal) if (animal { Animal.Cat) DoSomeAction (); } else if (animal Animal.Cow) { DoSome OtherAction...
-
(5pts) Consider the following multi-threaded C code: 1: // Barrier waits for n threads to call barrier_wait before 2: // allowing the threads to continue. 3: void barrier_init(barrier_t* b, unsigned...
-
Circle the correct phrase inside each parentheses: During itsexponential decay, the capacitor voltage decreases by (the sameamount, the same fraction) when the time increases by (the sameamount, the...
-
Refer to the data for problem 13-36 regarding Long Beach Pharmaceutical Company. Required: Compute each division's residual income for the year under each of the following assumptions about the...
-
The safety stock on an SKU is set at 500 units. The supplier says it has to increase the lead time from 4 to 5 weeks. What should be the new safety stock?
-
What is a hybrid strategy? Why is it used?
-
A company has an area for storing pallets as shown in the following diagram. How many pallets measuring 48 40 can be stored three high if there is a 2 space between the pallets? 200' 4' Aisle 4'
-
Nestls financial statements are presented in Appendix B. Financial statements of Delfi Limited are presented in Appendix C. Instructions Refer to the financial statements and answer the following...
-
Writing Financial statement information about four different companies is as follows. Instructions a. Determine the missing amounts. (Hint: For example, to solve for (a), Assets Liabilities = Equity...
-
The financial statements of TSMC are presented in Appendix A. The complete annual report, including the notes to the financial statements, is available at the companys website. Instructions Refer to...
Study smarter with the SolutionInn App