OX Quiz
Time limit1sMemory limit128 MB
Score each O by the length of its unbroken run of O characters and print the total for each test case.
- Level
Easy1 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Problem
You are given the grading result of an OX quiz as a string of O and X, such as OOXXOXXOOO. An O means the question was answered correctly, and an X means it was answered incorrectly.
When a question is correct, its score equals the number of Os in the consecutive run of correct answers ending at that question. For example, the last (10th) O in OOXXOXXOOO forms a run of three together with the 8th and 9th O, so it is worth 3 points.
Therefore the total score of OOXXOXXOOO is points.
Given the result string, write a program that computes the total score.
Input
The first line contains the number of test cases.
Each test case is given on its own line as a string consisting only of O and X. The length of the string is greater than and less than .
Output
For each test case, print the total score of the string on its own line.