백준 알고리즘/python

[ 8958 ] OX퀴즈

power-girl0-0 2021. 3. 2. 12:24
728x90

num = int(input())

for i in range(num):
    ox = list(str(input()))
    score = 0
    cnt = 1
    
    for j in ox:
        if(j == 'O'):
            score += cnt
            cnt += 1
        else:
            cnt = 1
    print(score)
728x90