M. Debug it!
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard 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≤n≤106), which means the length of the string.
The second line of input contains a string s(|s|=n,si∈{F,P}), which means Miamiao's result.
Output
Output a number, which means the minimum time needed to debug the problem by Huihui.
Example
inputCopy
4
FPPF
outputCopy
2