Problem: You are given a string made up of characters and . Initially you have no coins. You can perform two types of operations:
- Pick a substring , change it to , and get a coin.
- Pick a substring , change it to , and get a coin.
A substring of length is a sequence of two adjacent characters of a string.
Input Format: The input consists of multiple test cases. The first line of the input contains a single integer () — the number of test cases.
The only line of each test case contains the string (). All characters of are either or .
The sum of the lengths of over all test cases does not exceed .
Output Format: For each test case, output a single integer — the maximum number of coins you can obtain.
Note: In the first test case you can perform the following operations to get coins:
In the second test case you can perform the following operation to get coin:
In the third test case you can perform the following operations to get coins: