408984: GYM103401 M Debug it!
Description
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?
InputThe 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.
OutputOutput a number, which means the minimum time needed to debug the problem by Huihui.
ExampleInput4 FPPFOutput
2