Bob and Khatu are brave soldiers in World War 3. They have spotted an enemy troop which is planting bombs. They sent message to the command centre containing characters W and B where W represents a wall and B represents a Bomb. They asked command to tell them how many walls will be destroyed if all bombs explode at once. One bomb can destroy 2 walls on both sides.
Input:
First line of input contains number of test cases T. Each test case contains a single string which contains two type of chars 'W' and 'B'.
Output:
For each test case print the total number of destroyed wall.
Constraints:
1 ≤ T ≤ 10
1 ≤ |S| ≤ 105
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor