Count how many hand positions can be assigned without breaking a valid arrangement condition.
You are given a sequence of people, each of whom is either left-handed or right-handed. You may need to determine whether the arrangement is valid under a simple positional rule, or compute the maximum number of people that can remain in a valid state after making changes described by the input.
In this problem, focus on processing the sequence from left to right and applying the rule exactly as specified by the input format. The task is primarily about correctly simulating the arrangement and counting the result.
Read the sequence, apply the required checks or adjustments, and output the final count/value requested by the problem.
Note: This is a lightweight implementation-style statement reconstructed from the available title/metadata. Exact original constraints are not available here.
n.Because the original statement text is unavailable, interpret the input as a standard single-testcase simulation-style format.
1 <= n is assumed to be within typical competitive-programming limits.Example 1
Input
5 L R L R R
Output
3
Explanation
Illustrative example: after applying the stated rule to the sequence, the resulting answer is 3.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.