https://school.programmers.co.kr/learn/courses/30/lessons/140108
def solution(s):
cnt = 0
x_cnt, nonx_cnt = 0, 0
for i, c in enumerate(s):
if x_cnt == 0:
x = c
if x == c:
x_cnt += 1
else:
nonx_cnt += 1
if x_cnt == nonx_cnt:
cnt += 1
x_cnt, nonx_cnt = 0, 0
if x_cnt+nonx_cnt != 0:
return cnt+1
return cnt
x, x가 아닌 것의 수를 비교하여 같아질 때마다, 카운트를 초기화