Skip to content

Baekjoon 3986

1. Problem

문제 확인하기

2. Solution

n = int(input())
cnt = 0
for _ in range(n):
    s = input().rstrip()
    stack = []
    for i in s:
        if len(stack) == 0:
            stack.append(i)
        else:
            if stack[-1] == i:
                stack.pop()
            else:
                stack.append(i)
    if len(stack)==0:
        cnt +=1

print(cnt)