/ 제출 1 /
import sys
input = sys.stdin.readline
n = int(input())
answer = 0
for i in range(n):
words = list(input().strip())
stack = []
for word in words:
if not stack:
stack.append(word)
else:
if stack[-1] == word:
stack.pop()
else:
stack.append(word)
if not stack:
answer += 1
print(answer)
'CodingTest > Baekjun Online Judge' 카테고리의 다른 글
[ BOJ / 파이썬 ] 2504 괄호의 값 (0) | 2022.08.15 |
---|---|
[ BOJ / 파이썬 ] 10799 쇠막대기 (0) | 2022.08.15 |
[ BOJ / 파이썬 ] 5430 AC (0) | 2022.08.15 |
[ BOJ / 파이썬 ] 1021 회전하는 큐 (0) | 2022.08.14 |
[ BOJ / 파이썬 ] 2164 카드 2 (0) | 2022.08.14 |