408984: GYM103401 M Debug it!

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Debug it!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Miamiao writes a program and submits it to the judger. The judger tells her the result of each test case by a string containing P or F. P means to pass the test and F means to fail the test. Now Huihui wants to help her debug the program. He can remove the first or the last letter in $$$1$$$ minute or remove any other letter in $$$2$$$ minutes. After removing a letter from the middle the two remaining parts are joined.

Now, Huihui wants to know, how fast can he finish debugging the problem, which means he can obtain a string without any letter F?

Input

The first line of input contains an integer $$$n(1 \leq n \leq 10^6)$$$, which means the length of the string.

The second line of input contains a string $$$s(|s| = n, s_i \in \{F, P\})$$$, which means Miamiao's result.

Output

Output a number, which means the minimum time needed to debug the problem by Huihui.

ExampleInput
4
FPPF
Output
2

加入题单

上一题 下一题 算法标签: