언어, 알고리즘 공부/백준2020. 3. 7. 15:11[백준 알고리즘] 8958번 OX퀴즈 (Python)
import sys n = int(input()) for i in range(n): line = sys.stdin.readline() cnt = 0 sum = 0 for ch in line: if ch is 'O': cnt += 1 sum += cnt else: #'X' cnt = 0 print(sum) ▼ 링크 https://www.acmicpc.net/problem/8958