#P8080. [COCI 2011/2012 #4] KINO

[COCI 2011/2012 #4] KINO

Description

Each row in the cinema has NN seats. Seats are divided into regular seats (S\texttt S) and couple seats (L\texttt L). Couple seats always appear in pairs.

There is a cup holder between every two adjacent seats in the row (except between the two couple seats). In particular, there is also a cup holder at both ends of the row.

Now there are NN customers filling all NN seats. Find the maximum number of people who can use a cup holder.

Input Format

The first line contains an integer NN.

The second line contains NN characters S/L\texttt{S/L}, representing regular seats and couple seats.

Output Format

Output the maximum number of people who can use a cup holder.

3
SSS
3
4
SLLS
4
9
SLLLLSSLL
7

Hint

[Sample 3 Explanation]

If we use *\texttt * to represent cup holders, then the seats are as follows:

* S * L L * L L * S * S * L L *\texttt{* S * L L * L L * S * S * L L *}

[Constraints]

  • For 100%100\% of the testdata, 1N501 \le N \le 50.

[Hint and Notes]

This problem is translated from COCI 2011-2012 CONTEST #4 Task 1 KINO.

The score for this problem follows the original COCI settings, with a full score of 5050.

Translated by ChatGPT 5