Bob and Bombs
Practice
3.9 (77 votes)
Approved
Basic programming
Easy
Implementation
Open
Problem
71% Success 16935 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
22 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyException handlingImplementationjava
Points:20
54 votes
Tags:
ApprovedEasyImplementationOpen
Points:20
62 votes
Tags:
Easy