문제
풀이
def solution(arrangement):
cnt = 0
sticks = 0
lRazor = arrangement.replace("()",'R')
for x in lRazor:
if x == "(":
sticks += 1
elif x== ")":
sticks -= 1
cnt += 1
else:
cnt += sticks
answer = cnt
return answer
Reference
https://www.digitalculture.or.kr/koi/selectOlymPiadDissentList.do