n = int(input())
ox = []

for i in range(n):
    ox.append(input())

for x in ox:
    count = 0
    answer = 0
    for k in range(len(x)):
        if x[k] == "O":
            count += 1
            answer += count
        else:
            count = 0
            
    print(answer)

+ Recent posts