18th March is celebrated as the Valentine's Day in Insomnia-Land. The administration needs to devise an algorithm for pairing theindividuals who are still single. All such people looking for their special someone are lined up in a random order. The line would be represented as a sequence of letters: M and W: M representing a man and W representing a woman.
Now, to avoid chaos, only the individuals standing next to each other are allowed to pair up, be it two-men, or two-women, or one-man-and-one-woman. The task that lies ahead of you is to help the administration to devise such an algorithm that we first maximise the number of mixed pairs and then try to maximise the homo-pairs possible.
A Mixed Pair comprises of a Man(M) and a Woman(W). A Homo Pair comprises of either both Men(MM) or both Women(WW)
Input Format :
First line contains the number of test cases: t.
Next t lines contain each test case individually.
Each test case would consist of a string of uppercase letters: M and/or W.
Output Format :
For each test case, output on a separate line two space-separated integers :
The maximum number of mixed pairs possible and next the maximum number of
homo pairs possible. Remember that a pair can only be formed if the two people
stand next to each other in the line.
1 <= t <= 10
1 <= Length of the string <= 2000
Sample Input : 2
Sample Output :
Explanation: For the first case, we can simply get 2 mixed pairs. For the second case, if we pair up first two men, then we might only get 1 mixed pair and 1 homo pair. But since we can get 2 mixed pairs if we leave the first man alone, so the answer would be 2 mixed pairs and none homo pairs.