P29794 [洛谷] [COCI2011-2012#4] KINO
普及
题目描述

Problem Description

A movie theater has $N$ seats in each row. The seats are either regular seats (denoted as $\texttt S$) or love seats (denoted as $\texttt L$), with love seats always appearing in pairs.

Between every two adjacent seats in a row, there is a cup holder, except between the two love seats. Notably, cup holders are also present at both ends of the row.

Given that $N$ customers fill these $N$ seats, determine the maximum number of people who can use the cup holders.

Input Format

The first line contains an integer $N$.

The second line contains $N$ characters $\texttt{S/L}$, representing regular and love seats respectively.

Output Format

Output the maximum number of people who can use the cup holders.

Sample Input and Output

Sample Input #1

3
SSS

Sample Output #1

3

Sample Input #2

4
SLLS

Sample Output #2

4

Sample Input #3

9
SLLLLSSLL

Sample Output #3

7

Notes

Explanation for Sample 3:

If we denote cup holders with $\texttt *$, the seating arrangement looks like this:

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

Data Range:

  • For $100\%$ of the data, $1 \le N \le 50$.

Translated from COCI 2011-2012 CONTEST #4 Task 1 KINO.

This problem is scored according to the original COCI settings, with a maximum score of $50$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 SSS
样例输出
3