[Programmers] 문자열 나누기
Python
def solution(s):
answer = 0
current = ""
count = 0
for idx, val in enumerate(s):
if count == 0:
answer += 1
current = val
count += 1
else:
if current == val:
count += 1
else:
count -= 1
return answer
댓글남기기