might want to visit however many urban communities of this nation as could be expected under the circumstances. At first, they will pick some city to begin their excursion from. Every day, the explorer should go from the city where they presently are to an adjoining city utilizing one of the streets, and they can come a street provided that it is coordinated a similar way they are heading
Correct answer will be upvoted else downvoted. Computer science.
explorer might want to visit however many urban communities of this nation as could be expected under the circumstances. At first, they will pick some city to begin their excursion from. Every day, the explorer should go from the city where they presently are to an adjoining city utilizing one of the streets, and they can come a street provided that it is coordinated a similar way they are heading; i. e., if a street is guided from city I to the city i+1, it is feasible to make a trip from I to i+1, yet not from i+1 to I. After the voyager moves to an adjoining city, all streets shift their bearings to the contrary ones. On the off chance that the explorer can't go from their present city to an adjoining city, their excursion closes; it is likewise conceivable to end the excursion at whatever point the voyager needs to.
The objective of the explorer is to visit whatever number various urban areas as would be prudent (they can visit a city on different occasions, yet just the principal visit is counted). For every city I, ascertain the most extreme number of various urban areas the explorer can visit during precisely one excursion if they start in the city I.
Input
The principal line contains one integer t (1≤t≤104) — the number of experiments.
Each experiment comprises of two lines. The principal line contains one integer n (1≤n≤3⋅105). The subsequent line contains the string s comprising of precisely n characters, each character is either L or R.
It is ensured that the amount of n over all experiments doesn't surpass 3⋅105.
Output
For each experiment, print n+1 integers. The I-th integer ought to be equivalent to the greatest number of various urban areas the explorer can visit during one excursion if this excursion begins in the I-th city.
Step by step
Solved in 3 steps with 1 images