#K81422. Roller Coaster Final Position Calculation

    ID: 35750 Type: Default 1000ms 256MiB

Roller Coaster Final Position Calculation

Roller Coaster Final Position Calculation

In this problem, you are given a command string consisting solely of the characters 'F' and 'B'. Here, 'F' moves the roller coaster one step forward and 'B' moves it one step backward. Your task is to compute the final position of the roller coaster after executing all commands. Mathematically, the final position is calculated as:

position=NFNBposition = N_F - N_B

where $$N_F$$ is the number of forward moves and $$N_B$$ is the number of backward moves. Good luck!

inputFormat

The input is read from standard input (stdin). The first line contains an integer $$T$$ representing the number of test cases. Each of the next $$T$$ lines contains a non-empty command string, which consists only of the characters 'F' and 'B'.

outputFormat

For each test case, output a single line to standard output (stdout) containing the final position of the roller coaster.## sample

3
FFB
FBFBB
FFFBBB
1

-1 0

</p>