Mandy is a working artist and is commissioned to create some art pieces for 2018. The client wants Mandy to create art pieces out of cardboard boxes to display at the local art show. Occasionally, Mandy plans to drive by the local store on her way home to grab some boxes for her art pieces.
Mandy's cat, Willow, likes to play with every box that Mandy brings home. Willow plays with a box for days before getting bored of it. Once Willow is bored with a box, she never returns to it again, meaning that Mandy can finally use the empty box in her art projects.
If Mandy brings home another box before Willow finishes playing with the previous one, Willow will wait until she is bored with the previous box before moving onto the new one.
Given Mandy's box-shopping habits over the next days, can you determine by how many days the project will be delayed due to Willow?
The standard input will contain 10 datasets.
Each dataset begins with two integers and . The next lines each contain either the letter
B which represent whether Mandy came home empty-handed or with a box that day.
For each dataset, output the number of days that Willow will be playing with the boxes after the days given in the dataset.
3 5 E B E B E 2 4 B E E E
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org