#C9638. Pawns Covering

    ID: 53753 Type: Default 1000ms 256MiB

Pawns Covering

Pawns Covering

You are given a one-dimensional chessboard with \(n\) cells. Each cell is either empty or contains a pawn. The board is represented by a string of length \(n\) composed of the characters P (representing a pawn) and . (representing an empty cell).

Your task is to determine the maximum number of pawns that can be covered by rooks, under the restriction that no two rooks cover the same pawn. By the problem's constraints, each pawn can only be covered once and, in this scenario, a rook covering a pawn essentially means the pawn is counted. Hence, the problem boils down to simply counting the number of pawns present on the board.

Mathematically, the answer is given by: $$\text{Answer} = \#P$$ where $$\#P$$ denotes the number of occurrences of the character P in the board string.

inputFormat

The input is read from stdin and consists of two lines:

  • The first line contains an integer \(n\) representing the number of cells on the chessboard.
  • The second line contains a string of length \(n\) composed of characters P and ..

outputFormat

Output a single integer to stdout representing the maximum number of pawns that can be covered by rooks.## sample

7
.P..P.P
3