This page is still under construction.

Parts of this page are still being built. What you see may change.

OX Quiz

Time limit1sMemory limit128 MB

Summary
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 1+2+0+0+1+0+0+1+2+3=101+2+0+0+1+0+0+1+2+3 = 10 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 00 and less than 8080.

Output

For each test case, print the total score of the string on its own line.

Examples2

  1. Example 1

    Input
    5
    OOXXOXXOOO
    OOXXOOXXOO
    OXOXOXOXOXOXOX
    OOOOOOOOOO
    OOOOXOOOOXOOOOX
    
    Expected output
    10
    9
    7
    55
    30
    
  2. Example 2

    Input
    1
    O
    
    Expected output
    1