#C10995. Rearrange the Garden

    ID: 40261 Type: Default 1000ms 256MiB

Rearrange the Garden

Rearrange the Garden

You are given a garden represented as a sequence of cells. Each cell is either a path denoted by P, a flower bed denoted by F, or an empty cell denoted by ..

Your task is to rearrange the garden so that all empty cells are removed and no empty cells remain between any two non-empty cells. In the rearranged garden, all P cells must appear first, in the same order as they appear in the original sequence, followed by all F cells (again in the original order).

For example, if the garden is represented by P.F..P..F. (with n=10), the rearranged garden will be PPFF.

inputFormat

The input is provided via standard input and consists of two lines:

  1. The first line contains an integer n, which denotes the length of the garden sequence. (This value is provided for compatibility.)
  2. The second line contains a string s of length n, representing the garden cells. Each character in s is either P (path), F (flower bed), or . (empty cell).

outputFormat

Output a single line containing the rearranged garden sequence, where all empty cells are removed, all P cells appear first (in their original order), followed by all F cells (in their original order).

## sample
10
P.F..P..F.
PPFF